JavaScript tip: Number.isNaN() is not the same as isNaN().
Number.isNaN() checks if the value is exactly equal to NaN:
Number.isNaN(NaN) === true;
Number.isNaN("foo") === false;
isNaN() checks if the value isn't a number:
isNaN(NaN) === true;
isNaN("foo") === true;