JS Built-ins
GlobalFunctionsisNaNintermediate

isNaN β€” non-numeric string coerces to NaN

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

The global isNaN() coerces strings to numbers first β€” use Number.isNaN() to skip coercion.

isNaN with String

isNaN('hello') coerces the string to NaN and returns true.

Challenge: Verify the coercion.

πŸ’‘ Hints (1)
  • β€’ The global isNaN coerces its argument to a number first, unlike Number.isNaN.