1//split into array of strings.
2var str = "Well, how, are , we , doing, today";
3var res = str.split(",");
1var myString = "An,array,in,a,string,separated,by,a,comma";
2var myArray = myString.split(",");
3/*
4*
5* myArray :
6* ['An', 'array', 'in', 'a', 'string', 'separated', 'by', 'a', 'comma']
7*
8*/
1// Split string into an array of strings
2const path = "/usr/home/chucknorris"
3let result = path.split("/")
4console.log(result)
5// result
6// ["", "usr", "home", "chucknorris"]
7let username = result[3]
8console.log(username)
9// username
10// "chucknorris"
1var myString = 'no,u';
2var MyArray = myString.split(',');//splits the text up in chunks
3
1// bad example https://stackoverflow.com/questions/6484670/how-do-i-split-a-string-into-an-array-of-characters/38901550#38901550
2
3var arr = foo.split('');
4console.log(arr); // ["s", "o", "m", "e", "s", "t", "r", "i", "n", "g"]
1// Split a string into an array of substrings:
2var String = "Hello World";
3var Array = String.split(" ");
4console.log(Array);
5//Console:
6//["Hello", "World"]
7
8///*The split() method is used to split a string into an array of substrings, and returns the new array.*/