Multiple choice technology architecture

What will be the Output of the following JavaScript Statements? x=5+5; document.write(x); y="5"+"5"; document.write(y);

  1. x=10, y=10

  2. x=55,y=55

  3. x=10,y=55

  4. None of the above.

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

In JavaScript, the + operator behaves differently based on operand types. When both operands are numbers (5+5), it performs arithmetic addition yielding 10. When both operands are strings ('5'+'5'), it performs string concatenation yielding '55'. This is a classic example of type coercion in JavaScript.