Answers for "string to javascript array"

19

convert string to array js

// our string
let string = 'ABCDEFG';

// splits every letter in string into an item in our array
let newArray = string.split('');

console.log(newArray); // OUTPUTS: [ "A", "B", "C", "D", "E", "F", "G" ]
Posted by: Guest on October-23-2020
33

javascript explode

//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Posted by: Guest on June-14-2019
14

string to array javascript

const str = 'Hello!';

console.log(Array.from(str)); //  ["H", "e", "l", "l", "o", "!"]
Posted by: Guest on April-29-2020
4

js string to array

str = 'How are you doing today?';
console.log(str.split(' '));

>> (5) ["How", "are", "you", "doing", "today?"]
Posted by: Guest on October-22-2020
21

javascript split

// bad example https://stackoverflow.com/questions/6484670/how-do-i-split-a-string-into-an-array-of-characters/38901550#38901550

var arr = foo.split(''); 
console.log(arr); // ["s", "o", "m", "e", "s", "t", "r", "i", "n", "g"]
Posted by: Guest on May-01-2020
2

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
Posted by: Guest on January-17-2021

Code answers related to "string to javascript array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language