+ 2

How do i make the computer the understand that i want to add the numbers got from prompt command & not concatenate them??

Plz refer to the code... https://code.sololearn.com/Ww6bd9kJD9tc/?ref=app

25th Feb 2018, 6:04 PM
PiXeL99
PiXeL99 - avatar
4 odpowiedzi
+ 5
You just need to wrap both the prompt() inside Number(), and it's done!
25th Feb 2018, 6:10 PM
777
777 - avatar
+ 5
var a=parseInt(prompt("Enter a number.")); var b= parseInt(prompt("Enter a number.")); document.write(a+b);
25th Feb 2018, 6:16 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
Thankz guyz... This is the reason i love sololearn... quick help!!.... thankz everyone
25th Feb 2018, 6:22 PM
PiXeL99
PiXeL99 - avatar
+ 2
😀
25th Feb 2018, 6:25 PM
Sudarshan Rai
Sudarshan Rai - avatar