+ 2
It is adding 1+2 as 12 !!! Whereas substraction is perfect..
3 ответов
+ 7
You should add parseInt function to make them numbers first.
See the code :-
https://code.sololearn.com/Wl4Wghz5Cv9e/#js
+ 8
try: alert(Number(x)+Number(y));
- It is treating user input as a string.
+ 4
It is just because the parameters are string. For the + operation the program will join x and y. But the - operator doesn't exist for string, so the program will convert x and y to integers.