What Is The Operator Precedence Of Await?
In Javascript certain operators are processed before others: 1 + 2 * 3 // 1 + (2 * 3) // 7 because * has higher precedence than + 1 === 0 + 1 // 1 === (0 + 1) // true because + ha
Solution 1:
An AwaitExpression is a UnaryExpression and has the same precedence as delete
, void
, typeof
, +
, -
, ~
, and !
, binding stronger than any binary operator.
This is unlike yield
which has a precedence lower than anything else except the comma operator. This design decision was made because both yield a+b
and await a + await b
are scenarios thought to be more common than (yield a) + (yield b)
and await (a + b)
.
Post a Comment for "What Is The Operator Precedence Of Await?"