+ 2

Hey guys, could you just find an error in my code written in add() function...

I'm just perplexed to correct the addition operation. Does anyone help me out plz.... https://code.sololearn.com/W1vR82iTUkH5/?ref=app

30th Mar 2019, 2:41 PM
Sanjay Sahu Bandla
Sanjay Sahu Bandla - avatar
1 Odpowiedź
+ 2
var z = parseInt(x) + parseInt(y); Because prompt() returns string, so you need to type cast x and y into integer or float to prevent + from being overloaded to string concantention.
30th Mar 2019, 2:45 PM
Gordon
Gordon - avatar