Home >Web Front-end >JS Tutorial >What are the basic data types in js
The basic data types of JavaScript are: numbers, strings, Boolean values, undefined, null, objects and Symbol. Among them, numbers represent numerical values, strings represent character sequences, Boolean values represent true or false, undefined represents uninitialized or non-existent variables, null represents empty values, objects are the base classes of complex data structures, and Symbol represents the only immutable value. .
Basic data types of JavaScript
JavaScript provides a variety of basic data types for storage and representation Different types of values. These data types include:
1. Number
2. String
`$ The age of {name} is ${age}
#3. Boolean value
## represents An uninitialized or non-existent variable.
For example: let x; console.log(x); // Output undefinedIndicates a null value. Used when the value of a variable is unknown or empty. For example: let y = null;
Used to represent complex data structures such as arrays, functions, and Object. For example: array [1, 2, 3], function function myFunc() {}, object { name: 'John Doe' }
is mainly used for object properties to avoid property names. Conflict. For example: const mySymbol = Symbol('mySymbol');
The above is the detailed content of What are the basic data types in js. For more information, please follow other related articles on the PHP Chinese website!