This article does not do too much explanation, direct reference, just see two matrix graphs summarized on MDN, comparison is simple and clear, so carry over;
The = = comparison
Steps:
- == both sides are first converted to the same type, whether one side or the other depends on the original type of the value;
1. Compare the same type after conversion, which is equivalent to ===.
Convert found
- Undefined and null are special values that are true only when compared to themselves.
- If undefined or null is present on one side, the result is false;
- If one side is a number, the other side is implicitly converted to a number, the other side should be (string,bool);
- Both string and bool are implicitly converted to numbers;
I did not summarize the implicit conversions of Object, but found that all implicit conversions are superconversions to numbers;
Understand models of equality comparison
There are three ways to judge the equals sign
- = =
- = = =
- Object.is(value1,value2);
The difference is the result of the boundary special values;