I was reading the re-introduction to JavaScript on MDN and in the section Numbers it said that you can convert a string to a number simply by adding a plus operator
When you add a number and a string in Javascript the result is always a string.
Check the experiment here - http://jsfiddle.net/xuVur/1/
var a = "3" + 4 + 5; var b = 3 + 4 + "5"; $("#result1").html(a); // prints 345 $("#result2").html(b); //prints 75