Fixed function name
This commit is contained in:
@ -5,7 +5,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 the string to an array with the space as 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
|
```js
|
||||||
const stringToArray = str =>{
|
const stringToArrayOfWords = str =>{
|
||||||
[".", ",", "?", "!", "& ", "(", ")", "[", "]"].map(d => str = str.replace(d, ""));
|
[".", ",", "?", "!", "& ", "(", ")", "[", "]"].map(d => str = str.replace(d, ""));
|
||||||
return str.split(" ");
|
return str.split(" ");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user