Help with this string operation in JavaScript | SoloLearn: Learn to code for FREE!

+2

Help with this string operation in JavaScript

JavaScript Hi good day I would like to convert this String into a real operation without evaluating each character in the string. I mean, it automatically performs the operation, for example: Var res = "5 * 10-600 / 2"; // string Alert (res); // I WANT OUTPUT = 200 Is there any function that can shed the result of all this chain in this way ?. If it is possible for me to throw a floating value ....Thx

11/18/2016 10:23:09 AM

Freddy Alexander Paredes

2 Answers

New Answer

+2

Var res = eval("5 * 10-600 / 2"); Alert (res);

+2