DEV Community

loading...

Discussion on: Everything Wrong With JavaScript `eval()`

Collapse
maxprogramming profile image
Max Programming

I think it's because you are using const in the string.
In the expression, you are returning an expression. You cannot return a const. Just pass in a simple expression like 2+5 or something like a ternary operator