First, the main difference:
1. In layman's terms, = = is a comparison of values, and = = = Not only compares values, but also compares references to the same object.
2. When compared with = =, if the operands of the two numbers are of different types, they are converted first. The operand of = = = does not make any conversions.
3.if () is used in the = = judgment, case is used to determine the = = =.
For example if (null==undefined) returns True
switch (NULL) {
Case "undefined":
There's no execution here.
Break
}
Second, = = = More detailed
1. If 2 value types are different, they are not equal.
2. If two values are null, or undefined, or if one is null and the other is undefined, then they are not equal.
3. If there is one, or two are Nan, they are not equal. (Nan and any object of any value are unequal, including himself.) If if (x!==x) returns True, it indicates that X is Nan).
4. If two values are numeric and the values are equal, then both are equal. 0 and-0 are equally equal.
5. If it is a string, the content, the length, the encoding is different, then they do not wait.
6. If both reference values point to the same reference object, they are equal. If you point to a different reference value, even if they have exactly the same familiarity, the same is not equal.
Third, = = more detailed
1. If two values are null, or undefined, they are equal.
2. If one is a number and the other is a string, first convert the string to a number and then compare it.
3. If one of them is a Boolean value, first turn true to 1 or false to 0, and then compare.
4. If one is an object, one is a number or a string, the object is first converted to its original value and then compared.
= = In addition to the above 4, the other different types before the comparison are unequal. It is not the same object, even if it is a two object type, but not a reference.
Iv. Specific Cases
"A" ===string ("a")//true
"A" ===new String ("a")//false
[]==[]//false
{}=={}//false
2==[[[[2]]]]//true
var a=/124/,b=/124/;a==b//false
var a = function.length,b= new Function (). Lenth;a==b;//false
var a = date (0), B=new date (0), c=new date ();//Any comparison of the three is false
= = and = = = in JavaScript