The Lies of "===" operator
GiandoDev
Posted on April 30, 2020
It is funny to know that there is two occasions where === returns a lying result.
The first is:
0 === -0 // True
To avoid this is useful to use Object.is()
Object.is(0, -0) // False
The second is:
NaN === NaN // false
To avoid this is useful to use isNaN()
Number.isNaN(NaN) // True
💖 💪 🙅 🚩
GiandoDev
Posted on April 30, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.