How can I convert a string into a math operator in javascript
<p>If I've got a string that is a mathematic equation and I want to split it and then calculate it. I know I can use the eval() function to do this, but I'm interested if there's an alternative way to do this - specifically by splitting the strings first. So I've got something like</p>

<pre><code>var myString = "225 + 15 - 10"
var newString = myString.split(" ");
</code></pre>

<p>This would turn myString into an array: ["225", "+", "15", "-", "10"];</p>

<p>My next task is to turn all the odd-numbered strings into integers, which I think I could use parseInt(); for. My question is, how do I turn the "+" and "-" into actual arithmetic operators? So that at the end I am left with a mathematic expression which I can calculate?</p>

<p>Is this possible?</p>

<p>Thanks!</p>
