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 string in JavaScript. Hence + operator concatenates "1" + 2 + 3 and gives output as 123

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media