This article mainly introduces JavaScript variables and data types. It is the basic knowledge in getting started with JavaScript. If you need JavaScript data types, refer:
One of the most fundamental features of a programming language is a set of data types it supports. These are the types of values that can be expressed and manipulated in programming languages.
JavaScript allows three basic data types:
- Numbers, such as. 123,120.50.
- Such as "This text string.
- Boolean type, such as true or false.
JavaScript also defines two data types: null and undefined, each of which limits only one single value.
In addition to these basic data types, JavaScript supports Composite data types called objects. We will see the object details in a separate chapter.
Note: Java does not differentiate between integers and floating-point values. All numbers in JavaScript are expressed as floating point values. JavaScript represents a number that uses the 64-bit floating point format defined in the IEEE 754 standard.
JavaScript variable:
Like many other programming languages, JavaScript has variables. Variables can be considered named containers. You can put the data in these containers, and then refer to the data to simply name the container.
To use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows: