Help with this string operation in JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

18th Nov 2016, 10:23 AM
Freddy Alexander Paredes
Freddy Alexander Paredes - avatar
2 Answers
+ 2
Var res = eval("5 * 10-600 / 2"); Alert (res);
18th Nov 2016, 11:27 AM
Roland
+ 2
Thx you!
18th Nov 2016, 12:18 PM
Freddy Alexander Paredes
Freddy Alexander Paredes - avatar