JS variable contains 2 different data types of values
--------------------------------------------------------------------------------------------------------------- ---------------------------------------
1. Basic Type value
The basic type value concept--is a simple data segment, accessed by value, including undefined, Null, Boolean, number, String, without any properties and methods
The basic type value is copied--and a new value is created to replicate without affecting each other, saved in memory, completely independent
The base type value of the-->TYEPOF () can be judged, if it is a reference type (constructor), then return an object
2. reference type value
The reference type value concept----is an object with multiple values, accessed by reference, mainly constructors (classes), constructed from the new operator, including undefined, Null, Boolean, number, String, And more than one function object, there are corresponding properties and methods
The reference type value is copied--a pointer is copied, and two variables actually refer to the same object (in the subsequent constructor inheritance, if the prototype of the parent class is directly equal to the prototype of the subclass, then the subclass changes will also affect the parent class, The workaround is to have the parent class copy the prototype to the subclass), which is persisted in the heap memory and is an inherited relationship
A reference to the value of a type-->instanceof to determine which data type is referenced
js--understanding of data types