In a word: The original value is immutable, and the object reference is mutable.
The original values in JS (Undefined, null, Boolean, numeric, and string) are essentially different from objects (including arrays and functions). The original value cannot be changed, and no method can change an original value; for strings, all the methods in the string appear to return a modified string, which actually returns a new string value:
|1 2 3||var str= "Hello World"; S.touppercase (); S is still the same|
The comparison of the original values is a comparison of values: they want to wait only if their values are equal.
Objects differ from the original values, first they are mutable, and then the comparison of objects is not a comparison of values; objects are compared by reference: they want to wait only if they reference the same base object.
To compare 2 separate objects or arrays, you must compare their properties or elements as follows: