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

explanation of ** precedence? #709

Closed
johnsdean opened this Issue Oct 8, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@johnsdean

johnsdean commented Oct 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?

@rwaldron

This comment has been minimized.

Show comment
Hide comment
@rwaldron

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

Contributor

rwaldron commented Oct 8, 2016

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 rwaldron closed this Oct 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment