DEV Community

Discussion on: NaN and Set Keys

link2twenty profile image
Andrew Bone

MDN states it as fact but doesn't give an actual reason.

NaN and undefined can also be stored in a Set. All NaN values are equated (i.e. NaN is considered the same as NaN, even though NaN !== NaN).

nickytonline profile image
Nick Taylor Author • Edited on

Thanks Andrew!

I guess I should read the docs, although that did not occur to me based on NaN !== NaN. 🙃

Like you mentioned, It’d be nice to have a more thorough explanation in the docs though.