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

Use Blocked Scoped Variables #9

Merged
merged 3 commits into from
Jan 2, 2021

Conversation

p42-ai[bot]
Copy link
Contributor

@p42-ai p42-ai bot commented Jan 2, 2021

'Let' and 'const' are block-scope variable declarations that can replace 'var' declarations in many cases.

const declares blocked-scoped variables that cannot be re-assigned. let declares block-scoped variables that can be changed. They are available since ES6 and are preferred over function-scope, modifiable var declarations, because they make it easier to reason about the code.

When there are several variables declared in a statement, this refactoring does not change the declaration to prevent formatting breakages and linter issues.

var declarations are only changed if they are used within block-scope, and only variables that are not modified are marked as const.

**'Let' and 'const' are block-scope variable declarations that can replace 'var' declarations in many cases.**

`const` declares blocked-scoped variables that cannot be re-assigned. `let` declares block-scoped variables that can be changed. They are available since ES6 and are preferred over function-scope, modifiable `var` declarations, because they make it easier to reason about the code.

When there are several variables declared in a statement, this refactoring does not change the declaration to prevent formatting breakages and linter issues.

`var` declarations are only changed if they are used within block-scope, and only variables that are not modified are marked as `const`.
@domoritz domoritz force-pushed the p42/es6_block_scoped_variables/1609611584741 branch from a1bf2a5 to 5a46459 Compare January 2, 2021 18:32
@domoritz domoritz merged commit ba5f982 into master Jan 2, 2021
@domoritz domoritz deleted the p42/es6_block_scoped_variables/1609611584741 branch January 2, 2021 18:39
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.

None yet

1 participant