I've got an array [1,2,3] I've just joined it with '+' leaving me with the string
"1+2+3"
How can I evaluate that to get the answer 6.
I've got an array [1,2,3] I've just joined it with '+' leaving me with the string
"1+2+3"
How can I evaluate that to get the answer 6.
You could use eval
:
var result = eval("1+2+3");