js text to array 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
str = 'How are you doing today?';
console.log(str.split(' '));
>> (5) ["How", "are", "you", "doing", "today?"]
Example 4: js string to array
var myString = 'no,u';
var MyArray = myString.split(',');//splits the text up in chunks
Example 5: convert a string to array in javascript
// Designed by shola for shola
str = 'How are you doing today?';
console.log(str.split(" "));
//try console.log(str.split("")); with no space in the split function
//try console.log(str.split(",")); with a comma in the split function
Example 6: convert string to array javascript
let myArray = str.split(" ");