0
How to add two variables??
var a = 2 var b = 3 document.write(a+b) Output is 23, And i want it to be 5
5 Respostas
+ 2
Basic JavaScript Addition:-
var x = 1;
var y = 2;
var result = x + y;
The result is "3".Add numbers in JavaScript by placing a plus sign between them.
+ 1
I believe you put the 2 and 3 in quotation marks (“2” and “3”) which will do something called concatenation so that it returns 23. If you want the mathematical addition, do not put them in quotation marks
0
For js : use
console.log(a+b);
but that also outputs 5. check again...
0
How are you getting 23? The code you have shown will output 5.