Hey guys, could you just find an error in my code written in add() function... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
+ 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