Hello,
I need to trap an eval expression, perhaps using IsNan. What I've currently got results in errors via the browser. I can't seem to catch the result of eval via IsNan. Any ideas appreciated.
I'm trying to evaluate the total of an arithmetic formula.
eg. expr == "43*45+*34" (This shouldn't evaluate to an number, should it?)
I try to check if it's valid like this
if (isNan(eval(expr)) {
alert("invalid expression"
}
but depending on what I put in the expression (any combination of numbers and arithmetic operators), I get syntax errors, "; expected" etc.
Any help appreciated.
Graeme
I need to trap an eval expression, perhaps using IsNan. What I've currently got results in errors via the browser. I can't seem to catch the result of eval via IsNan. Any ideas appreciated.
I'm trying to evaluate the total of an arithmetic formula.
eg. expr == "43*45+*34" (This shouldn't evaluate to an number, should it?)
I try to check if it's valid like this
if (isNan(eval(expr)) {
alert("invalid expression"
}
but depending on what I put in the expression (any combination of numbers and arithmetic operators), I get syntax errors, "; expected" etc.
Any help appreciated.
Graeme