(no title)
michaelmartin | 11 years ago
1 + "2" (12) does a string concatenation. 1 - "2" (-1) does math.
That said, whilst JS is loosely typed and won't fall over when you do this, I'd just see it as bad form to find code mixing types to this extent. Just because the language will let you do it, doesn't mean you should actually do it!
TazeTSchnitzel|11 years ago
Nitramp|11 years ago
But all of that's fine compared to PHP's implicit number conversion that ignores trailing characters, presumably so that you can add "3 onions" to "1 kg of bacon" or some such...
timepiece|11 years ago
Retra|11 years ago