mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 07:47:54 -05:00
Avoid the word "mutate" while explaining const
This commit is contained in:
@@ -89,7 +89,7 @@ Other Style Guides
|
||||
|
||||
- [2.1](#2.1) <a name='2.1'></a> Use `const` for all of your references; avoid using `var`.
|
||||
|
||||
> Why? This ensures that you can't reassign your references (mutation), which can lead to bugs and difficult to comprehend code.
|
||||
> Why? This ensures that you can't reassign your references, which can lead to bugs and difficult to comprehend code.
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
@@ -101,7 +101,7 @@ Other Style Guides
|
||||
const b = 2;
|
||||
```
|
||||
|
||||
- [2.2](#2.2) <a name='2.2'></a> If you must mutate references, use `let` instead of `var`.
|
||||
- [2.2](#2.2) <a name='2.2'></a> If you must reassign references, use `let` instead of `var`.
|
||||
|
||||
> Why? `let` is block-scoped rather than function-scoped like `var`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user