DEV Community

Discussion on: I just created my first NPM package. It ain't much but it's honest work

Collapse
 
supercoww profile image
Ambar Mutha • Edited

If simply true is returned, input NaN (not a number) will also return true. It turns out typeof NaN is number. Also NaN - NaN is NaN so this expression num - num === 0 returns true only when num is a number except NaN.

Collapse
 
ispoljari profile image
Ivan Spoljaric • Edited

Yeah. And same goes for Infinity and -Infinity.