Skip to content

Commit 7dabe47

Browse files
Merge pull request ryanmcdermott#149 from Endlessline/patch-1
Fix issue ryanmcdermott#130
2 parents 89a0725 + 17512c3 commit 7dabe47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ saveCityZipCode(address.match(cityZipCodeRegex)[1], address.match(cityZipCodeReg
106106
```javascript
107107
const address = 'One Infinite Loop, Cupertino 95014';
108108
const cityZipCodeRegex = /^[^,\\]+[,\\\s]+(.+?)\s*(\d{5})?$/;
109-
const [, city, zipCode] = address.match(cityZipCodeRegex);
109+
const [, city, zipCode] = address.match(cityZipCodeRegex) || [];
110110
saveCityZipCode(city, zipCode);
111111
```
112112
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)