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

Prevent top level variable creation #1037

Open
BarbourSmith opened this issue Nov 3, 2021 · 0 comments
Open

Prevent top level variable creation #1037

BarbourSmith opened this issue Nov 3, 2021 · 0 comments

Comments

@BarbourSmith
Copy link
Contributor

Since top level definitions should be immutable we should be blocking users from creating variables using var or let at the top level. Probably just throwing a clear error is the solution.

The example which brought this up is:

let str = '';

for (let i = 0; i < 9; i++) {
  str = str + i;
}

console.log(str);
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