+ 1

Add Function

I want to make an add function but it is adding both numbers combinely if the first is 5 and the second is 10 then it will be 510 so plz help me.

9th Apr 2018, 9:48 AM
Junaid Qureshi
4 Respuestas
9th Apr 2018, 9:59 AM
Rull Deef 🐺
Rull Deef 🐺 - avatar
+ 2
You probably concatenate strings "5" and "10". Write + in front of nums in function to parse it like nums
9th Apr 2018, 9:55 AM
Rull Deef 🐺
Rull Deef 🐺 - avatar
+ 2
Use parseInt(); to extract integer from a string / prompt!
9th Apr 2018, 9:57 AM
777
777 - avatar
0
Thanks for helping me!
9th Apr 2018, 10:00 AM
Junaid Qureshi