JS Built-ins
NumberisNaNintermediate

Number.isNaN() β€” NaN !== NaN, use Number.isNaN instead

πŸ“– Usage Example
// Check for NaN without coercion
Number.isNaN(NaN)    // β†’ true
Number.isNaN('NaN')  // β†’ false (no coercion)
Number.isNaN(42)     // β†’ false

Use Number.isNaN() instead of the global isNaN() to check for NaN without coercing the argument first.

Why Not Use === for NaN?

NaN === NaN is false β€” you cannot use strict equality to check for NaN. Use Number.isNaN() instead.

πŸ’‘ Hints (1)
  • β€’ `NaN` is the only value in JavaScript not equal to itself.