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

Redeclaration of const should throw SyntaxError #15

Open
ghost opened this issue Jun 16, 2018 · 1 comment
Open

Redeclaration of const should throw SyntaxError #15

ghost opened this issue Jun 16, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 16, 2018

You can do attempt to change a const variable without any error. For example, it should throw an error SyntaxError: redeclaration of const y instead of silently not reassigning y in this code

const y = 2;
y = 4;
print(y); // prints 2
@ghost
Copy link
Author

ghost commented Jun 18, 2018

I see an error is thrown when strict mode is enabled.

Is there a reason why you're checking for strict mode before throwing an error for const?

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

0 participants