In JS, there are no types of variables, data types, JS data types are divided into two categories, 1. Base data type (Undefined, Null, Boolean, number, Infinity, Nan, String) 2. Reference type (object): Why the first data type is called the base data type, not the value type, because string is more special. The definition of a string is a reference type, but its operation is a value type, which defines a variable x, assigns the string "abc" to x, at which point X points to the first address of the "ABC" array, and when the x is assigned to Y, the first address of the array is assigned to Y, so that the data in the heap is unchanged. X and Y also point to the first address of the array in the heap, and when you want to modify the value of Y, that is, when you modify the array by Y, the heap will be in the application of a space, the original value is copied into the new array values, modified, by x access is an unmodified string array, through Y access to the modified character array, The string definition is a reference type, which is used for the value type.
About JS Basic type string