Previous Words
The data types of JavaScript can be divided into two types: primitive type (basic type or simple type) and reference type.
Primitive type: undefined,null,boolean,number,string five kinds;
Reference type: object,array,function;
Corresponding to this, their values are referred to as primitive values and complex values, respectively.
Attribute Original value
The original value is the lowest or simplest form of data or information that is available in JavaScript. The values of the primitive types are referred to as the original values because their values are not fine-grained. That is, the number is a number, the string is a string, and the Boolean value is true and false,undefined and null are undefined and null. These values are simple and cannot represent values that are made up of other values.
An obvious feature of the original value is that it cannot be changed, and no method can change the original value.
var s = "Hello"; s.touppercase (); Console.log (s ) ; // "Hello"
Complex values
Complex values can have many different types of JavaScript to make up, and complex objects can contain any value, rather than a specific known value.
Objects differ from the original values, they are mutable, and their values can be modified.
var 0 = {x:1= 2= 3; Console.log (o.x); // 2; Console.log (O.Y); // 3;
Storage Mode Stack Storage
Because the original value occupies space fixed, is a simple data segment, in order to facilitate the query speed of the variable, it is stored in the stack (stack).
Heap Storage
Because the size of the complex value changes, it cannot be stored in the stack, otherwise it will reduce the query speed of the variable, so stored in the heap (hack), the value stored at the variable is a pointer to the memory of the storage object.
Primitive values and complex values in JavaScript