File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 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++) {
112112### Use explanatory variables
113113** Bad:**
114114``` javascript
115- let cityStateRegex = / ^ (. + )[,\\ s] + (. +? )\s * (\d {5} )? $ / ;
115+ const cityStateRegex = / ^ (. + )[,\\ s] + (. +? )\s * (\d {5} )? $ / ;
116116saveCityState (cityStateRegex .match (cityStateRegex)[1 ], cityStateRegex .match (cityStateRegex)[2 ]);
117117```
118118
119119** Good** :
120120``` 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 ];
125125saveCityState (city, state);
126126```
127127** [ ⬆ back to top] ( #table-of-contents ) **
You can’t perform that action at this time.
0 commit comments