Home >Web Front-end >JS Tutorial >Summary of JavaScript data types

Summary of JavaScript data types

巴扎黑
巴扎黑Original
2017-08-13 14:45:001119browse

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 type

Function data type

Object data type is divided into: array[], object{}, regular RegExp, date object

The 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 space

The function data type consists of two parts:

1. Function definition phase Definition 3 steps

1) Open up a new space address

2) Put all the JS code in the function as The string is stored in this space

3) Assign the space address to the function name

2. The function call phase calls 2 steps

1) When the function is called A private scope will be formed

2) Execute the string in the previous heap memory as JS code

The above is the detailed content of Summary of JavaScript data types. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn