JS Built-ins
NumberisNaNintermediate

Number.isNaN() β€” '1' (string) returns false, unlike global isNaN

πŸ“– 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.

Number.isNaN() vs global isNaN β€” Strings

isNaN('hello') returns true (coerces string to NaN). Number.isNaN('hello') returns false (no coercion).

πŸ’‘ Hints (1)
  • β€’ `Number.isNaN` never coerces β€” it only returns `true` for the actual `NaN` value.