The editor below will bring you an old-fashioned talk about js data types. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.
js data types are mainly divided into basic data types and reference data types
Basic data The difference between types and reference data types:
Basic data types are references to values, while reference data types are references to addresses;
Basic data types are stored in stack memory , the stack memory provides an environment for JS code execution, and the reference data types are stored in the memory
The basic data types include:
Array array
string string
number number
beloon Boolean value
null
undefined
##Reference data types include:
Object data typeFunction data typeObject data type is divided into: array[], object{}, regular RegExp, date objectThe steps for storing object data types in memory:
1. Open up a new space address; 2. Put the keys in the object Values are stored in this memory space;3. Assign the space address to a variable name, pointing to the current spaceThe function data type consists of two parts:
1. Function definition phase Definition 3 steps1) Open up a new space address2) Put all the JS code in the function as The string is stored in this space3) Assign the space address to the function name2. The function call phase calls 2 steps1) When the function is called A private scope will be formed2) Execute the string in the previous heap memory as JS codeThe above is the detailed content of Summary of JavaScript data types. For more information, please follow other related articles on the PHP Chinese website!