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

More emphasis on const gotchas? #90

Open
chakrit opened this issue Jul 29, 2015 · 1 comment
Open

More emphasis on const gotchas? #90

chakrit opened this issue Jul 29, 2015 · 1 comment

Comments

@chakrit
Copy link

chakrit commented Jul 29, 2015

const x = { 'hello': 'world' };
x['hello'] = 'alien';
console.log(x['hello']); // prints 'alien'
x = { }                  // fails silently.
console.log(x['hello']); // still prints 'alien'

This (correctly) prints 'alien' but may not be apparent to many people. I think this should be at least noted in the example.

@getify
Copy link
Contributor

getify commented Jul 29, 2015

// fails silently.

that won't be true of a conforming implementation. it'll throw an error affirmatively.

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

2 participants