Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 30, 2020 06:54 am GMT

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

More about comparison operators MDN


Original Link: https://dev.to/giandodev/the-lies-of-operator-1dfm

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To