0

Addition in JS?

I'm fairly new to code, but I've been trying to make a prompt-based calculator. Everything works fine, but addition works weirdly. Like, say if we did 7 + 5 it would come out as 75. Help?

16th May 2017, 2:04 AM
Avyaansh
Avyaansh  - avatar
1 Antwort
+ 2
7+5 is 75 because 7 and 5 are strings, not integers. Convert them, then add them.
16th May 2017, 2:07 AM
Rrestoring faith
Rrestoring faith - avatar