Fixed typo and added another example
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
Converts a given string into an array of words
|
||||
|
||||
First create an array of dirt that you want to remove from the string. Then replace each dirt with an empty string. Use `String.split(' ')` to conver string to array with the space a delimiter.
|
||||
First create an array of dirt that you want to remove from the string. Then replace each dirt with an empty string. Use `String.split(' ')` to conver the string to an array with the space as a delimiter.
|
||||
|
||||
```js
|
||||
const stringToArray = str =>{
|
||||
@ -11,4 +11,5 @@ const stringToArray = str =>{
|
||||
}
|
||||
|
||||
// stringToArrayOfWords("I love javaScript!!") -> ["I", "love", "javaScript"]
|
||||
// stringToArrayOfWords("python, javaScript & coffee") -> ["python", "javaScript", "coffee"]
|
||||
```
|
||||
Reference in New Issue
Block a user