Answer the question
In order to leave comments, you need to log in
How to do calculations inside input in javascript?
The script takes a number from input, performs some calculations on it, and outputs the result.
It would be more convenient to fill this input with something like "16384 + 256" so that the script takes this amount and goes on working.
"But how, Holmes?" ©
Answer the question
In order to leave comments, you need to log in
The easiest option:
var value = '(5+7)*10';
var res = new Function('return ' + value);
console.log(res()) // => 210
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question