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

length of an array, and elements of arguments object outside strict mode, are not actually accessor properties, but rather proxied data properties #341

Open
lewisje opened this issue May 29, 2016 · 0 comments

Comments

@lewisje
Copy link

lewisje commented May 29, 2016

TL;DR: It might be better to say they act like getters and setters, with a footnote explaining they're even more exotic than that.

The length property of an array, and the elements of the arguments object, are actually data properties:

Object.getOwnPropertyDescriptor([], 'length');
//=> Object {value: 0, writable: true, enumerable: false, configurable: false}
(function () {return Object.getOwnPropertyDescriptor(arguments, 0);})(undefined); // passing in no arguments returns just `undefined`
//=> Object {value: undefined, writable: true, enumerable: true, configurable: true}

The behavior of both of these things can be approximated by an object wrapped in an ES6 Proxy but maybe talking about that would be too much, considering most of this guide is not written for ES6; also, to my understanding, the link outside strict mode between the arguments object and named arguments cannot be so approximated, because the scope object that the named arguments are properties of cannot be accessed via script.

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