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

Global scope pollution #18

Closed
dfsq opened this issue Oct 3, 2014 · 2 comments
Closed

Global scope pollution #18

dfsq opened this issue Oct 3, 2014 · 2 comments

Comments

@dfsq
Copy link

dfsq commented Oct 3, 2014

There are several places where variable definitions lick into global scope. For example:

for( ix in sections ) { ... }

In the above example ix variable should be declared with var keyboard, otherwise ix becomes global variable.

@tomByrer
Copy link
Contributor

tomByrer commented Oct 3, 2014

*leak

This is lick ;)
likcing contest pic

I think the IIFE protects from global leakage into the other scripts? But perhaps a few extra var inside sub-functions can help with garbage collection...

@dfsq
Copy link
Author

dfsq commented Oct 3, 2014

Lick :)

No, even though wrapped into IIFE, assignment to undeclared variable will result into global variable. More over in strict mode there would be "ReferenceError: assignment to undeclared variable" error.

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

3 participants