April 30, 2020 06:54 am GMT
Original Link: https://dev.to/giandodev/the-lies-of-operator-1dfm
The Lies of "===" operator
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
Original Link: https://dev.to/giandodev/the-lies-of-operator-1dfm
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To