Variable in JavaScript
One of the most distinctive features of a program language is the set of data types it supports. This is the type of value that can be represented and manipulated in the program language.
JavaScript data type
One of the most distinctive features of a program language is the set of data types it supports. This is the type of value that can be represented and manipulated in the program language.
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: