+ 1

var apples ="3" var oranges ="3" alert(+apples + +oranges);

Why the Result is 5 ???

27th Jan 2018, 1:37 PM
Demi Louka
Demi Louka - avatar
2 Respostas
+ 5
in JavaScript prefixing a variable with "+" coverts it to an integer/number.your question should be var apples="3" oranges="2" so 3+2=5
27th Jan 2018, 1:45 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
thanks :)
27th Jan 2018, 1:51 PM
Demi Louka
Demi Louka - avatar