Multiple choice technology programming languages

What is the output of the below JavaScript?


alert(parseInt("8.56") + " " + parseInt("8error"));     

  1. Error

  2. 98

  3. 88

  4. 16

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

parseInt() parses integers from strings, stopping at the first non-numeric character. parseInt("8.56") returns 8 (stops at the decimal). parseInt("8error") also returns 8 (stops at 'e'). The alert concatenates these with a space: "8 " + " " + "8" = "8 8". Note: The code has extra spaces that may affect output formatting, but the numeric values are definitely 8 and 8.