Report Bug
Qus :

What will be the output of the following JavaScript snippet?

console.log("5" + 3);

Qus

नीचे दिए गए JavaScript स्निपेट का आउटपुट क्या होगा?

console.log("5" + 3);


A. 53
B. 8
C. 2
D. Error


Solution
A. 53



Explanation
<p><span style="font-size: 14px;">"5" is a string.</span></p><p><span style="font-size: 14px;">3 is a number.</span></p><p><span style="font-size: 14px;">When the + operator is used with a string, JavaScript performs string concatenation instead of numeric addition.</span></p><p><span style="font-size: 14px;">The number 3 is automatically converted to the string "3".</span></p>



Report Bug