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 @@ -102,16 +102,16 @@ setTimeout(() => {
102102** Bad:**
103103``` javascript
104104const address = ' One Infinite Loop, Cupertino 95014' ;
105- const cityStateRegex = / ^ [^ ,\\ ] + [,\\ \s ] + (. +? )\s * (\d {5} )? $ / ;
106- saveCityState (address .match (cityStateRegex )[1 ], address .match (cityStateRegex )[2 ]);
105+ const cityZipCodeRegex = / ^ [^ ,\\ ] + [,\\ \s ] + (. +? )\s * (\d {5} )? $ / ;
106+ saveCityZipCode (address .match (cityZipCodeRegex )[1 ], address .match (cityZipCodeRegex )[2 ]);
107107```
108108
109109** Good** :
110110``` javascript
111111const address = ' One Infinite Loop, Cupertino 95014' ;
112- const cityStateRegex = / ^ [^ ,\\ ] + [,\\ \s ] + (. +? )\s * (\d {5} )? $ / ;
113- const [, city , state ] = address .match (cityStateRegex );
114- saveCityState (city, state );
112+ const cityZipCodeRegex = / ^ [^ ,\\ ] + [,\\ \s ] + (. +? )\s * (\d {5} )? $ / ;
113+ const [, city , zipCode ] = address .match (cityZipCodeRegex );
114+ saveCityZipCode (city, zipCode );
115115```
116116** [ ⬆ back to top] ( #table-of-contents ) **
117117
You can’t perform that action at this time.
0 commit comments