6 ms·
OK here's plain english simple explain... Left hand side is a string, and "+" is string concatenation as well as addition. So '5' + 3 = '53' (String concatenat
by maximusprime 15y ago
OK here's plain english simple explain...
Left hand side is a string, and "+" is string concatenation as well as addition. So '5' + 3 = '53' (String concatenation). Just as "Hello" + 1 would equal "Hello1". The right hand side is converted to a string.
Left hand side is a string, but "-" is subtraction for numbers. JS converts the '5' to a number, then subtracts. So '5' - 3 = 2 (Numerical subtraction).
That's the explanation, and it's not terribly hard to get past.
- barrkel 15y agoThe issue isn't explaining it. The issue is it needing an explanation at all.