+ 2
I have a messed up JavaScript calculator code, what is wrong?
I have a messed up code that says this: function addition(){ var addinput1 = prompt("enter your first number") var addinput2 = prompt("enter your second number") var adding = addinput1+addinput2 alert(addinput1 + " plus " + addinput2 + " equals " + adding)} Is there something Iām not seeing because it doesnāt work what ever I try
9 Answers
+ 3
link to code
did you add ; in real code?
+ 3
Thanks for the tip
+ 2
What?
+ 2
https://code.sololearn.com/WLwo3J8hjlHm/?ref=app
you needed to use parseInt as it was treating the inputs as strings
+ 2
Thank you so much
+ 1
meaning code it here on sololearn then press share then copy link. paste link here
+ 1
A lil tip: var adding = +addinput1 + +addinput2;
This essentially reads the strings as numeric.