Base type data is stored in stack memory, while reference type data is stored in heap memory

Basic type: Number Boolean Undefined String Null

Reference type: Object Function

 

The Object and Array in JS are reference types

 

When you declare a reference type with a variable, the variable is not actually the reference type itself, but a pointer to the reference type. This pointer points to the storage address of the object in heap memory. Copying to another object actually copies the address of that object to another object variable. Both Pointers point to the same object, so when one changes, the other changes, as shown in the figure below

 

Parse (json.stringify (data));