Multiple choice technology web technology

HTML: javascript: alert(parseInt(name.value)); What is The Output When The User Enters 08 in the text field ?

  1. 8

  2. 0

  3. NaN

  4. 08

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

parseInt() without a radix interprets strings starting with 0 as octal. '08' starts with 0 but 8 is not a valid octal digit (0-7 only), so parsing stops at the invalid digit and returns 0. This is a classic JavaScript gotcha.