Skip to content
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

Chapter 1, Closures and Scope, grandparents example #63

Open
zackgao opened this issue Feb 18, 2014 · 0 comments
Open

Chapter 1, Closures and Scope, grandparents example #63

zackgao opened this issue Feb 18, 2014 · 0 comments

Comments

@zackgao
Copy link

zackgao commented Feb 18, 2014

function (x) {
return function (x, y) {
return function (w, z) {
return function (w) {
return x + y + z
}
}
}
}

"When evaluating x + y + z, JavaScript will find x and y in the great-grandparent scope and z in the parent scope. The x in the great-great-grandparent scope is ignored, as are both ws. When a variable has the same name as an ancestor environment’s binding, it is said to shadow the ancestor."

Above should be grandparent instead of great-grandparent and great-grandparent instead of great-great-grandparent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant