It seems that I have also seen null = undefined, null! = Undefined.
Recently I 've looked at other people's program source code, and there are some such as if (x! = Undefined & x! = Null & x! = "") And so on, suddenly felt that the write is very wordy, I usually directly if (x) {} No matter whether it is null, undefined, or "", it is true that it is false in the condition judgment. Why should it be so arrogant? (However, if your x = 0 is also a valid value, you cannot use if (x) {} for condition determination)
To prove this redundancy, I also made the following tests:
Var;
Alert (x)
If (x = null ){
Alert ('failed ')
}
X is an uninitialized variable, that is, undefined.
Run the above Code: undefined and failed are successively displayed, indicating that x = null is qualified.
We can directly use alert (null = undefined) to find that true is returned.
This indicates that x = null | x = undefined or x! = Null & x! = Undefined is redundant!
Generally, you only need to judge null or undefined.