0
How we add two int in javascript without getting catenation .make sure number taken by user
7 Réponses
+ 2
When I try the code I provided earlier, it works perfectly for me. E.g.
Input: 8
Input: 13
Output: 21
Remember that you can’t enter words like eight or five into the input boxes.
Please tell us what you input and what you get as an output.
+ 2
You can look this tutorial and I hope you will get your answer..
https://code.sololearn.com/c4I400c9D4As/?ref=app
+ 1
It's not work I triead that method but still number concatinate but I want addition
+ 1
Okk I get it .Earlier I doesn't include number so it take as a string .One more thing plz tell Number take as a variable or Number is a predefine
+ 1
The Number function is a predefined function that converts something to a number (either an integer or a float/double).
0
var variable1 = Number(prompt("Enter a number:"));
var variable2 = Number(prompt("Enter another number:"));
document.write(variable1 + variable2);
// The Number function turns a variable into a number.
0
Durgesh Nigam JavaScript, not Java.