JS Built-ins
GlobalFunctionsparseIntbeginner

parseInt β€” non-numeric string returns NaN

πŸ“– Usage Example
parseInt('abc')          // β†’ NaN
isNaN(parseInt('abc'))   // β†’ true

parseInt() returns NaN when the string does not start with a parseable integer.

parseInt NaN

parseInt('abc') cannot be parsed and returns NaN.

Challenge: Verify that isNaN(parseInt('abc')) is true.

πŸ’‘ Hints (1)
  • β€’ NaN is returned when a string cannot be converted to a number.