NaN comparison

Since NaN is not equal to anything, including himself:

Determine whether it is NaN: isNaN (value) — convert value to a number and test whether it is NaN

                            Can't compare like this: value === NaN

Special built-in method: Object.is (a, b) — a === b? true: false  

                         Note: Object.is (NaN, NaN) === true;

                                 Object.is(+0, -0) === false;

                      So this built-in method is mostly used to compare edge cases.

Guess you like

Origin www.cnblogs.com/LangZ-/p/12738389.html