Skip to content

Prevent top level variable creation #1037

@BarbourSmith

Description

@BarbourSmith

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions