[solved] Joining contents of array question

[solved] Joining contents of array question
0.0 0

#1

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

I mean having something like:

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

equation.join(’’);

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?


#2

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(""))


#3

Wow, that works like a charm. Thanks.