1 2 3 4 5 6 | function doMath( formula ) { // Strip leading "=" if there if (formula.charAt(0) === '=') formula = formula.substring(1); return eval(formula) } |
Direct link: https://paste.plurk.com/show/2677030
1 2 3 4 5 6 | function doMath( formula ) { // Strip leading "=" if there if (formula.charAt(0) === '=') formula = formula.substring(1); return eval(formula) } |