The variable types of JavaScript are divided into basic types and reference types. Basic types include: null, Undefined, Boolean, string, number, reference type is Object
The basic type and reference type are accessed in a different way, the former accesses a real memory address, and the latter accesses a reference to the memory address.
var num1 = 5; var num2 = NUM1;
var New Object (); var obj2 = obj1;
The pass parameter when the function is called is passed by value and the memory value of the argument is obtained from the parameter copy. For the base type, the modification of the parameter does not affect the argument, since the copy is followed by two separate memory, and for the reference type, the parameter modification affects the argument, the copy is two references, but points to the same memory.
JavaScript variable/Type design