2 ms·
In JavaScript, "1"+2 is 12. In Python, it's a TypeError. Same goes for most other types. JS is generally happy to convert everything to everything, often via
by int_19h 8y ago
In JavaScript, "1"+2 is 12.
In Python, it's a TypeError.
Same goes for most other types. JS is generally happy to convert everything to everything, often via strings. So even utter nonsense, like multiplying a function by an array, still works (the result is NaN). Conversely, in Python, such implicit conversions are rarely in the play - the one you see most is int/float.