[solved] Joining contents of array question

[solved] Joining contents of array question


Is it possible to created an array and join the contents into an equation?

I mean having something like:

var equation = [‘1’, ‘*’, ‘3’];


and winding up with the answer - which in this case would be 3?

Is there a way to make something like this work or am I think about it all wrong and need to go back to the drawing board?


You might want to have a look at eval() though it’s really a tricky thing apparently but I know it was used for the calculator project.

So something like eval(equation.join(""))


Wow, that works like a charm. Thanks.