Basic types of data are stored in the stack memory, the reference data type is stored in the heap memory
Basic types: Number Boolean undefined String Null
Reference types: Object Function
Object js objects and arrays are reference types Array
When using a reference type variable declaration, in fact, this is not a reference type variable itself, but rather a reference point to this type of pointer. The pointer to the heap memory in the memory address of the object. Process copied to another object is to actually copy the address of the object to another object variable, both pointers point to the same object, thus changing one, the other will change, particularly as shown below
That clone, if necessary depth: JSON.parse (JSON.stringify (data));