Multiple choice technology web technology

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

  1. 12

  2. 0

  3. 10

  4. NaN

  5. None Of These

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

parseInt() without a radix interprets '012' as octal. In octal, 012 equals decimal 10 (1*8^1 + 2*8^0 = 8 + 2 = 10). The leading zero signals octal mode.