Tashen Jazbi
Tashen Jazbi

Reputation: 1068

evaluating mathematical expression in titanium javascript

i'm using titanium studio. I've a mathematical expression to evaluate. for example I've this mathematical expression.

var expr='9+4*6/3';

i don't want to evaluate it step by step like first i'll be doing multiplication then devision etc. is there any faster way to solve or is there any function in MATH class in titanium which can give the solution of an expression. like

var result=MATH.func(expr);

any help would be much appreciated.

thanks

Upvotes: 0

Views: 215

Answers (1)

MichaelM
MichaelM

Reputation: 316

Not sure if eval is available in Titanium, but eval(expr) should work in normal circumstances.

Check this question for other ideas on how to do it without eval

Upvotes: 1

Related Questions