Mathematical expression evaluator in JavaScript