Value type
1. Value type: string/number/boolean/undefined;
2. Store: Data of value type, storing variables of data itself;
3. Assignment: Copy the stored data directly to the assignment, and two copies of the data are completely independent in memory. One of the data is modified and the other is unaffected.
4. Use in functions: Modify the parameters inside the function without affecting the outside variables.
Reference type
1. Reference type: object;
2. Storage: Reference type of data, stored in the memory of the data address, data in memory stored separately;
3. Assignment: Copy the address stored in the variable to a separate store, but two variables share the same object. When one of the objects is modified and another reference is accessed, the modified object is also accessed.
4. Use in functions: Modifying the object inside a function affects variables outside.
JavaScript value types and reference types