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", "!"]
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 str = "12,15,16,78,59";
2var res = str.split(",");
3console.log(res[0]); // result: 12
4console.log(res[2]); // result: 16
1var test= "Hi I am a fullstack developper";
2var result= test.split("l");
3//return:
4// [Hi I am a fu,,stack deve,lopper]
5
6/*the split methode replace the (letter/symbole) into the
7brackets to "," and transform it to array.*/