Basic data types in JavaScript

There are eight basic data types in JavaScript (Annotation: The first seven are basic data types, also called primitive types, and object is a complex data type).

number is used for any type of number: integer or floating point, integer in the range of ±(253-1).
bigint is used for integers of arbitrary length.
string is used for character strings: a character string can contain 0 or more characters, so there is no separate single character type.
boolean is used for true and false.
null is used for unknown values-an independent type with only one null value.
undefined is used for undefined values-independent types with only one undefined value.
symbol is used for a unique identifier.
object is used for more complex data structures.
We can view the type of data stored in the variable through the typeof operator.

Two forms: typeof x or typeof(x).
The type name is returned as a string, such as "string".
typeof null will return "object"-this is a bug in the JavaScript programming language, in fact it is not an object.

Guess you like

Origin blog.csdn.net/weixin_45730243/article/details/109156167