DEV Community

Discussion on: What is the oddest JavaScript behavior?

Collapse
 
willsmart profile image
willsmart • Edited

It makes sense why, but I think it's a pity that

0 === -0

AFAIK it's the only instance where you can have two quite different values that are to all intensive purposes considered identical. They even have effectively identical signs via Math.sign.
You have to do a hack like

1/-0 !== 1/0

just to tell them apart.