update snippets 0-All
This commit is contained in:
committed by
Agamemnon Zorbas
parent
6bedb8fba4
commit
0c129cdd02
@ -7,6 +7,9 @@ Omit the second argument to use the default regex.
|
||||
|
||||
```js
|
||||
const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean);
|
||||
// words("I love javaScript!!") -> ["I", "love", "javaScript"]
|
||||
// words("python, javaScript & coffee") -> ["python", "javaScript", "coffee"]
|
||||
```
|
||||
|
||||
```js
|
||||
words("I love javaScript!!") -> ["I", "love", "javaScript"]
|
||||
words("python, javaScript & coffee") -> ["python", "javaScript", "coffee"]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user