Skip to content

Commit 55e612d

Browse files
authoredJan 5, 2017
Merge pull request ryanmcdermott#28 from tonytran1/master
Use constants when variable values do not change
2 parents c51445e + f090f77 commit 55e612d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed
 

‎README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ var yearMonthDay = moment().format('YYYY/MM/DD');
5252
```
5353
**[⬆ back to top](#table-of-contents)**
5454

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+
5573
### Use the same vocabulary for the same type of variable
5674

5775
**Bad:**
@@ -1951,7 +1969,7 @@ function hashIt(data) {
19511969
```
19521970
**[⬆ back to top](#table-of-contents)**
19531971

1954-
### Don't leave commented code in your codebase
1972+
### Don't leave commented out code in your codebase
19551973
Version control exists for a reason. Leave old code in your history.
19561974

19571975
**Bad:**

0 commit comments

Comments
 (0)