Please i need help... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please i need help...

var num1 = prompt("1?"); var num2 = prompt("2?"); var sum = num1 + num2; alert(sum); I need to make a sum but only add the two numbers entered, please is there any solution?

3rd Apr 2019, 12:03 AM
Propy Grammar Moruzian
Propy Grammar Moruzian - avatar
1 Answer
+ 5
If I understand your question correctly, all you would need to do is use the parseInt() function with each of the variables to convert them into integers, allowing you to add them together. https://www.w3schools.com/jsref/jsref_parseint.asp
3rd Apr 2019, 12:25 AM
Faisal
Faisal - avatar