HTML and CSS Reference
There are numerous inconsistencies in the examples above, and again, these are often bugs
rather than features. Null should not be considered equal to undefined , despite the fact they
are both falsey values they represent very different data-types and meanings.
These compare variables based on both their value and their data type, and therefore
provide more expected results:
> null === undefined
> 5 === "5"
> "true" === true
> "1" === true
It is best practice to always use these equality operators unless you consciously want to
compare two values you know have different data types.
If you want to know whether any value is true or false in a Boolean sense, you
can print it out by prepending !! to it. A single ! will negate a Boolean value,