+ 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
2 Respostas
+ 2
Var res = eval("5 * 10-600 / 2");
Alert (res);
+ 2
Thx you!