Table of Contents
This guide covers variable in JavaScript with practical context and easy-to-follow details. Use it to understand the subject and apply the information confidently.
JavaScript Data Type
JavaScript lets you work with the following three types of original data:
- Numbers, for example : 123, 120. 50, .
- Text string , for example: "This text string", .
- Boolean For example: true or false.
JavaScript also defines two common data types, Null And Undefined , each of which only defines a single value. In addition to these data types, JavaScript supports a mixed data type called Object . We will discuss the details of objects in a separate chapter.
Note - Java does not distinguish integer values and floating-point values. All numbers in JavaScript are represented as floating point values. JavaScript represents numbers using the 64 bit floating-point format defined by the IEEE 754 standard.
Variables in JavaScript
Like many other program languages, JavaScript has variables. Variables can be considered a named container. You can put data into this container and then refer to this data simply by naming the container.
Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the keyword Var As follows: