0

for example, if I had a STRING = "3+3*(4-1)" if a ran a function and wanted it to solve the equation using javascript, what Would I start with?

Dav Per
  • 1
  • 1

1 Answers1

1

Assuming the equation has a correct syntax of javascript, you can use eval to evaluate the value.

i.e. eval("3+3*(4-1)") = 12

Lukabot
  • 189
  • 3
  • 11