Answers for "Calculate string value in javascript, not using eval"

1

Calculate string value in javascript, not using eval

let str = "12/5*9+9.4*2"

let res1 = eval(str)
console.log('res1:', res1)

let res2 = (new Function('return '+str)())
console.log('res2:', res2)
Posted by: Guest on December-24-2020

Code answers related to "Calculate string value in javascript, not using eval"

Code answers related to "Javascript"

Browse Popular Code Answers by Language