Expert Developer JavaScript Question: Download Expert JavaScript Developer PDF

What would "1"+2+3 and 1+2+"3" evaluate to, respectively?

Tweet Share WhatsApp

Answer:

When the first character is a string, the remaining characters will be converted into a single string, rendering 123.
If the string is at the end, the initial characters will perform normal mathematical functions before converting into a string, resulting in 33.

Download Expert JavaScript Developer PDF Read All 150 Expert JavaScript Developer Questions
Previous QuestionNext Question
What is the disadvantages using innerHTML in JavaScript?What is event bubbling, and why is it beneficial to use?