1
2
3
4
5
6
function doMath( formula ) {
// Strip leading "=" if there
if (formula.charAt(0) === '=')
formula = formula.substring(1);
return eval(formula)
}