-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting an error when using parse().evaluate function #237
Comments
It looks like you're using the parse and evaluate functions correctly, but you're getting a syntax error in the evaluated string ( |
I'm only getting this stuff in the console:
Even when I click on the equals sign and then open up the console, I don't see anything that should've been logged from And the |
@silentmatt I changed the equals click handler to this: const parser = new exprEval.Parser();
const handleEqualsClick = event => {
setEqualsClicked(true);
const stored = `${storedValue}${currentValue}`;
setStoredValue(stored);
console.log(storedValue);
let calculatedValue;
try {
calculatedValue = parser.parse(storedValue).evaluate();
} catch (err) {
console.log(`Error occurred: ${err}`);
}
setCurrentValue(`${calculatedValue}`);
setStoredValue(`${stored}${event.target.textContent}`);
}; and made sure to remove spaces from the string constructed as the value for And for some reason What am I doing wrong here? |
I'm getting this error message:
when I try to use the
parse().evaluate()
function. What am I doing wrong? Full source code is on GitHub here. Thanks in advance for replies and help.The text was updated successfully, but these errors were encountered: