string convert into array in javascript code example

Example 1: javascript explode

//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");

Example 2: string to array javascript

const str = 'Hello!';

console.log(Array.from(str)); //  ["H", "e", "l", "l", "o", "!"]

Example 3: js string to array

var myString = 'no,u';
var MyArray = myString.split(',');//splits the text up in chunks

Example 4: javascript string to array

const str = 'Hello!';

const arr = Array.from(str);
//[ 'H', 'e', 'l', 'l', 'o', '!' ]

Example 5: how to change string to array in javascript

a=anyElement.all

// console.log(a)
Array.from(a).forEach(function (element){
    console.log(element)
})

Tags:

Java Example