Let's do a show-by-example, but try to guess for before clicking the button!
var n = 1;
var leet = "1337";
var text = "text";
> n + n
> text + n // Rule: If it can convert the types to make it work, it will.
> text - n // It can't substract a number from a string
> leet + n // Here it gets tricky: both vars can be converted to number and string, so which does it choose?
Rule: Converting to string precedes converting to number. Also n+leet would be converted to a string.
> leet * n // string+num became string and you can't multiply a string, so NaN
But no, the "if it can convert" rules here. It converts to a number, so if we combine the previous two...
> leet * n + n // ... it will suddenly treat it as a number.
> parseInt(leet) + 1 // Conclusion: to do string+number as calculation, we'll need to convert ourselves
> (prompt("number?", "30") + 10) / 25
Of course this gave a ridiculous number, 120.4 instead of 1.6 when using the default value of the prompt. It took a while to figure out that it doesn't see the number I gave as a number, especially since it worked other times with different arithmetic.