JavaScript has a whole definition of equality for this particular case called SameValueZero: https://tc39.es/ecma262/multipage/abstract-operations.html#s... Everything is compared bitwise equal (so to speak), except 0 == -0.
> new Map().set(-0, -0).set(0, 0).set(NaN, NaN)
Map { 0 → 0, NaN → NaN }
I don't really understand the reason for this instead of Object.is equality (aka SameValue), which would distinguish -0 and 0.