File tree
Expand file treeCollapse file tree1 file changed
+19
-1
lines changed Expand file treeCollapse file tree1 file changed
+19
-1
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -52,6 +52,24 @@ var yearMonthDay = moment().format('YYYY/MM/DD');
|
52 | 52 | ```
|
53 | 53 | **[⬆ back to top](#table-of-contents)**
|
54 | 54 |
|
| 55 | +### Use ES6 constants when variable values do not change |
| 56 | +In the bad example, the variable can be changed. |
| 57 | +When you declare a constant, the variable should stay |
| 58 | +the same throughout the program. |
| 59 | + |
| 60 | + |
| 61 | +**Bad:** |
| 62 | +```javascript |
| 63 | +var FIRST_US_PRESIDENT = "George Washington"; |
| 64 | +``` |
| 65 | + |
| 66 | +**Good**: |
| 67 | +```javascript |
| 68 | +const FIRST_US_PRESIDENT = "George Washington"; |
| 69 | +``` |
| 70 | +**[⬆ back to top](#table-of-contents)** |
| 71 | + |
| 72 | + |
55 | 73 | ### Use the same vocabulary for the same type of variable
|
56 | 74 |
|
57 | 75 | **Bad:**
|
@@ -1951,7 +1969,7 @@ function hashIt(data) {
|
1951 | 1969 | ```
|
1952 | 1970 | **[⬆ back to top](#table-of-contents)**
|
1953 | 1971 |
|
1954 |
| -### Don't leave commented code in your codebase |
| 1972 | +### Don't leave commented out code in your codebase |
1955 | 1973 | Version control exists for a reason. Leave old code in your history.
|
1956 | 1974 |
|
1957 | 1975 | **Bad:**
|
|
You can’t perform that action at this time.
0 commit comments