make a string into an array js code example
Example 1: string to array javascript
const str = 'Hello!';
console.log(Array.from(str)); // ["H", "e", "l", "l", "o", "!"]
Example 2: js string to array
str = 'How are you doing today?';
console.log(str.split(' '));
>> (5) ["How", "are", "you", "doing", "today?"]
Example 3: how to change string to array in javascript
a=anyElement.all
// console.log(a)
Array.from(a).forEach(function (element){
console.log(element)
})
Example 4: split array by character javascript
s.split("");