Multiple choice technology web technology

To what value will the following expressions evaluate in the JavaScript console? a = 4; b = 6; a+++b;

  1. 11

  2. 10

  3. 12

  4. None of the above

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

The expression a+++b is parsed as a++ + b, where a++ evaluates to 4 (then increments to 5), so 4 + 6 equals 10. The operator precedence matters - ++ has higher precedence than +.