1// our string
2let string = 'ABCDEFG';
3
4// splits every letter in string into an item in our array
5let newArray = string.split('');
6
7console.log(newArray); // OUTPUTS: [ "A", "B", "C", "D", "E", "F", "G" ]
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*/
1const str = 'Hello!';
2
3console.log(Array.from(str)); // ["H", "e", "l", "l", "o", "!"]
1var myString = 'no,u';
2var MyArray = myString.split(',');//splits the text up in chunks
3
1function reverseString() {
2 const myString = 'Hello';
3 const splits = myString.split("").reverse().join("");
4}