What will be evaluated value of calculatedValue for following expression

var calculatedValue = 1+2+"3";

Solution

In the above expression, the calculation is started from left to right and 1 is considered as number in JavaScript. Hence + operator adds 1 + 2  and result 3.  Further "3" is considered as string in Javascript. Hence 3 + "3" result to 33.

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media