To check that the contents of the boxes (values or references) are exactly the same, use the stricter a === b
.
This requires a and b to be of the same type.
It is false
if both a and b are NaN
It is false
if one is null
and the other is undefined
The test for NOT being identical can be done with !==
Equality, a == b
, allows the types to be different if, after type conversion (eg, string or boolean to number), the results are then the same.
It is true
if both a and b are NaN
It is true
if one is null
and the other is undefined
null
(keyword) is a special value that you can assign to a variable to indicate that it is intentionally an object with no reference. Why? Sometimes for debugging purposes but also to assist garbage collection (next page). It is quite different from undefined
.