Q. What will be the output of the following JavaScript code snippet?
Code:
<p id="demo"></p>
var txt1 = "mcqbuddy_";
var txt2 = "Javascriptmcq";
document.getElementById("demo").innerHTML = txt1 + txt2;
β
Correct Answer: (D)
mcqbuddy_Javascriptmcq
Explanation: The + operator in javascript acts as a concatenation operator when used with string. The new string does not have any space between the two added strings.