How To Convert Array To A Mathematical Computation Expression?
I tried to write a computation mathematical expression and store each sign into an array. For example, I want to convert the array: let arr = ['10', '-', '(', '2', '+', '1', ')', '
Solution 1:
It will not validate your input but eval(arr.join("")) will do it.
eval takes a string and executes it as it were a js expression.
Post a Comment for "How To Convert Array To A Mathematical Computation Expression?"