File tree
Expand file treeCollapse file tree1 file changed
+5
-5
lines changed Expand file treeCollapse file tree1 file changed
+5
-5
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -112,16 +112,16 @@ for (var i = 0; i < MINUTES_IN_A_YEAR; i++) {
|
112 | 112 | ### Use explanatory variables
|
113 | 113 | **Bad:**
|
114 | 114 | ```javascript
|
115 |
| -let cityStateRegex = /^(.+)[,\\s]+(.+?)\s*(\d{5})?$/; |
| 115 | +const cityStateRegex = /^(.+)[,\\s]+(.+?)\s*(\d{5})?$/; |
116 | 116 | saveCityState(cityStateRegex.match(cityStateRegex)[1], cityStateRegex.match(cityStateRegex)[2]);
|
117 | 117 | ```
|
118 | 118 |
|
119 | 119 | **Good**:
|
120 | 120 | ```javascript
|
121 |
| -let cityStateRegex = /^(.+)[,\\s]+(.+?)\s*(\d{5})?$/; |
122 |
| -let match = cityStateRegex.match(cityStateRegex) |
123 |
| -let city = match[1]; |
124 |
| -let state = match[2]; |
| 121 | +const cityStateRegex = /^(.+)[,\\s]+(.+?)\s*(\d{5})?$/; |
| 122 | +const match = cityStateRegex.match(cityStateRegex) |
| 123 | +const city = match[1]; |
| 124 | +const state = match[2]; |
125 | 125 | saveCityState(city, state);
|
126 | 126 | ```
|
127 | 127 | **[⬆ back to top](#table-of-contents)**
|
|
You can’t perform that action at this time.
0 commit comments