+ 1
How do you calculate a string?
For example: Var equation = "30+54"; Var answer = equation; Equation = 30+54 Answer = 84
10 Respostas
+ 5
console.log(+"30"+(+"54")) //đ
+ 5
you can use eval function đ
+ 3
Console.ReadLine() by itself wont work, as you need the value to be an integer. This is where our old friend Convert.ToInt32 comes in. This allows us to take the integer values out of the input and use it as a variable.
var Q = Console.ReadLine(Convert.ToInt32);
Console.WriteLine(Q);
+ 3
You can also use:
console.log(Number("5")+Number("5"))
+ 2
NinjaGamer64, initially the question was: "30"+"54" đ€
But in this case: "30+54" - of course eval()
+ 1
from your needs I suppose you need to try the eval() function...
A sample Javascript code is given below
var num1 = "123 + 456";
var sum = eval(num1);
console.log(sum)
Terminal:
____________________________________
579
0
Use eval.
0
var equation = "30+54"
var answer = eval(equation);
console.log(answer);
0
Reenasky it should automatically increment the numbers