What's the difference between this? And why do they produce the same result? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the difference between this? And why do they produce the same result?

document.write("5"+6); output // 56 document.write(5+6); output // 11 https://code.sololearn.com/W0pJt1mR32zp/?ref=app

23rd Jan 2020, 11:33 AM
onazi joshua
onazi joshua - avatar
1 Answer
+ 6
When one of the operators is string, the number will be converted to a string and concatenated (glued together). What's that code link in your question? It seems to be totally unrelated.
23rd Jan 2020, 11:38 AM
HonFu
HonFu - avatar