Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upexplanation of ** precedence? #709
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
rwaldron
Oct 8, 2016
Contributor
I believe you've misread or misunderstood the grammar (which defines the precedence): https://tc39.github.io/ecma262/#sec-exp-operator
Take a look at the tests for practical examples: https://github.com/tc39/test262/blob/master/test/language/expressions/exponentiation/exp-operator.js
|
I believe you've misread or misunderstood the grammar (which defines the precedence): https://tc39.github.io/ecma262/#sec-exp-operator Take a look at the tests for practical examples: https://github.com/tc39/test262/blob/master/test/language/expressions/exponentiation/exp-operator.js |
rwaldron
closed this
Oct 8, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
johnsdean commentedOct 8, 2016
I think the specification says that ** and / are at the same level of precedence, / has left-to-right associativity, and ** has right-to-left associativity. Testing shows that 4 / 2 ** 2 evaluates to 1. That leads me to believe that ** has higher precedence or somehow the ** associativity overrides the / associativity. 1. Can you verify that ** really has the same precedence as / ? 2. Can you explain how the associativity works on the example I gave?