πŸ“Š JavaScript
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;
  • (A) error
  • (B) mcqbuddy_ Javascriptmcq
  • (C) undefined
  • (D) mcqbuddy_Javascriptmcq
πŸ’¬ Discuss
βœ… 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.

Explanation by: Chandani
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.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
105
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Chandani
Publisher
πŸ“ˆ
99%
Success Rate