+ 2

Java script , helpme out please..

var input1 = document.getElementById("number1").value; var input2 = document.getElementById("number2").value; document.write(input1 + input2); this is the code considering that inputs are 5 and 5 then the output should be 10 but the actual output comes as 55. please help me out what is wrong or missing here...

26th Jul 2018, 4:31 AM
Madhav
Madhav - avatar
3 Answers
+ 2
It's because you try to add two strings
26th Jul 2018, 4:37 AM
Lstiti
+ 1
Stalevar , Jay Matthews , Leszek thanks a lot to all of you for help
26th Jul 2018, 5:41 AM
Madhav
Madhav - avatar
0
Stalevar can you please tell me more about parse
26th Jul 2018, 5:23 AM
Madhav
Madhav - avatar