What does the following evaluate to?
"1"+2+4
What about this:
5 + 4 + "3"
In the first case since "1" is a string, everything is a string, so the result is "124". In the second case, its 93.what is happening here? Why does addition happen in one instance, while string concatenation occurs in the other?
var x = "1" + 2 + 4;
var z = 5 + 4 + "3";
console.log(x); // "124"
console.log(z); // 93
Can anyone explain this?
1 + ""(converts number to string)"3". In the first one"1" + 2gets done first. Which results in a string of"12"..so then it just adds 4 to that string resulting in"124"