547 B
547 B
title, tags
| title | tags |
|---|---|
| changeStringToArrayOfChars | array,intermediate |
Function takes string as a parameter and returns an array of characters.
- Array.prototype.split() divides a given string to separate characters
- In this case
split()takes in an empty string as an argumentstr.split('') - Separator can be a string or a regural expression
const changeStringToArrayOfChars = text => {
return text.split('');
}
changeStringToArrayOfChars('jsisawesome'); // ["j", "s", "i", "s", "a", "w", "e", "s", "o", "m", "e"]