You have used null
. You have used undefined
. But, have you ever thought about what they mean to the world and to Javascript?
The fact is quite simple - we can’t do a null
equality check.
|
|
The same holds for undefined
.
|
|
But, they measure up to themselves and to each other.
|
|
Practical usage of null
and undefined
, therefore, follow this pattern -
|
|
You should not be using this -
|
|
Yes, even if the whole world is trying to push you towards the reinforced equality operator, you can push back those forces with some help from null
.