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

Please don't use implicit variable declarations! #151

Merged
merged 2 commits into from
Oct 17, 2017

Conversation

fluffywaffles
Copy link
Contributor

This should be an error when running JavaScript in ES5 "strict mode," because implicit variables in JavaScript become globals. It's a small thing, but having the declaration (const/let/var, whichever -- although I've used const out of preference), will hopefully reduce confusion for beginners (who should expect all variables to be declared!) and make the code more idiomatic.

This should be an error when running JavaScript in ES5 "strict mode," because implicit variables in JavaScript become globals. It's a small thing, but having the declaration (const/let/var, whichever -- although I've used `const` out of preference), will hopefully reduce confusion for beginners (who should expect all variables to be declared!) and make the code more idiomatic.
@CLAassistant
Copy link

CLAassistant commented Oct 17, 2017

CLA assistant check
All committers have signed the CLA.

@jennifer-shehane jennifer-shehane self-requested a review October 17, 2017 17:29
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch! It's really important to us to have examples copy/paste-able and be valid.

We initially wrote the docs in ES5 but have the intention of updating everything to ES6, so there are definitely some ES5 examples floating around, but const is a good choice.

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

Successfully merging this pull request may close these issues.

3 participants