var b = 2;
var c = a+b;
In this way, the solution of c is12;
Using the Number () function can solve this problem, as follows?
Var c = number (a)+number (b);
In this way, the solution of c is 3.
Extended data
The value of the JavaScript Number () function object is converted to a number.
& ltscript type = " text/JavaScript " & gt;
Var test 1= new Boolean (true);
var test 2 = new Boolean(false);
var test3 = new Date();
Var test4= new string ("999");
Var test5= new string ("999888");
document . write(Number(test 1)+" & lt; br />);
document . write(Number(test2)+" & lt; br />);
document . write(Number(test3)+" & lt; br />);
document . write(Number(test4)+" & lt; br />);
document . write(Number(test5)+" & lt; br />);
& lt/script & gt;