ES6 data type

1. Basic data types (6 types)

type of data From the ES version typeof
null ES5 Object
undefined ES5 undefined
boolean ES5 boolean
number ES5 number
string ES5 string
symbol ES6 symbol

2. Reference data type (2 types)

type of data From the ES version typeof
object ES5 object
function ES5 function

3. Access, modify and copy

  • Basic data types: save values ​​in the stack and access by value. The operation is their actual value, and the different variables do not interfere with each other.
  • Reference data type: save the address in the stack and access by reference. When querying, find the value in the heap memory according to the address; when modifying, multiple variables under shallow copy save the same address, any modification of a variable will change the value under the corresponding address, you can use deep copy to solve this problem.

4. Data type detection

5. Data type conversion

Guess you like

Origin blog.csdn.net/SJ1551/article/details/107746850