JavaScript variables can be used to hold two types of values: the base type value and the reference type value.
There are 5 types of base type values: Undefined,null,boolean,number,string
There are two types of reference type values: Functions, objects.
Characteristics of base type values and reference type values:
1, the basic type value in memory occupies a fixed size of space, so is stored in the stack memory;
2, from one variable to another copy of the basic type of value, will create this worth a copy;
3, the value of the reference type is an object, stored in the heap memory;
4. A variable containing a value of a reference type actually contains not the object province, but a pointer to the object;
5. The value of the copied reference type from one variable to another, and the pointer is copied, so two variables end up pointing to the same object;
6. Determine which base type a value can use the TypeOf operator, and determine which reference type can use the instanceof operator.
The difference between a JavaScript reference type and a base type