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 #268

Merged
merged 1 commit into from
Dec 1, 2020

Conversation

p42-ai[bot]
Copy link
Contributor

@p42-ai p42-ai bot commented Dec 1, 2020

'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 merged commit c0b6feb into master Dec 1, 2020
@domoritz domoritz deleted the p42/dbcb67f1-db0e-44a1-821a-c60f7b0a1160 branch December 1, 2020 17:54
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.

1 participant