Evaluating a string as a mathematical expression in javascript

Posted by wheresrhys on Stack Overflow See other posts from Stack Overflow or by wheresrhys
Published on 2010-02-16T20:18:10Z Indexed on 2010/03/13 22:05 UTC
Read the original article Hit count: 395

Filed under:
|
|
|

If I have a string '1+1' is there a way, other than eval(string) to get the numerical value of it i.e. I want to turn '1+1' into 2.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about string