www.fgks.org   »   [go: up one dir, main page]

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

Implement Function variable scope quirk #42

Open
CapacitorSet opened this issue Sep 23, 2017 · 0 comments
Open

Implement Function variable scope quirk #42

CapacitorSet opened this issue Sep 23, 2017 · 0 comments

Comments

@CapacitorSet
Copy link
Owner

In JavaScript, "Functions created with the Function constructor do not create closures to their creation contexts; they always are created in the global scope. When running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the Function constructor was called", per MDN. This is not true in JavaScript, and this inconsistence is being exploited "in the wild" as seen in this sample.

MDN reports that this does not happen for eval with code for a function expression, so it's worth looking into as a possible way to implement this quirk in a rather clean way.

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

No branches or pull requests

1 participant