Javascript Tricky Questions

Q) What does “1”+2+4 evaluate to?
Ans: Since 1 is a string, everything is a string, so the result is 124.

Q) What does 3+4+”7″ evaluate to?
Ans: Since 3 and 4 are integers, this is number arithmetic, since 7 is a string, it is concatenation, so 77 is the result.

Leave a Reply