Open
Description
When you write code like the following
const expr = "2 -3";
console.log(evaluate(expr)); // 2
You will get 2
instead of -1
, this is because the tokenizer parses -3
into a number instead of an operator and a number.
If you want to get -1
,please add a space before 3
, like below
const expr = "2 - 3";
console.log(evaluate(expr)); // -1
Metadata
Metadata
Assignees
Labels
No labels