I need to compare two numeric values for equality in Javascript. The values may be NaN as well. I\'ve come up with this code:
NaN
if (val1 == val2 |
And what's about the function Number.isNaN() ? I believe this must be used whenever is possible.
> NaN === NaN false > Number.isNaN ƒ isNaN() { [native code] } > Number.isNaN() === Number.isNaN() true
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN