JavaScript eksploduje
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Grepper
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
var myString = "An,array,in,a,string,separated,by,a,comma";
var myArray = myString.split(",");
/*
*
* myArray :
* ['An', 'array', 'in', 'a', 'string', 'separated', 'by', 'a', 'comma']
*
*/
const str = 'Hello!';
console.log(Array.from(str)); // ["H", "e", "l", "l", "o", "!"]
var myString = 'no,u';
var MyArray = myString.split(',');//splits the text up in chunks
str = 'How are you doing today?';
console.log(str.split(' '));
>> (5) ["How", "are", "you", "doing", "today?"]
/* split methods splits string object into array of strings
and join method changes element of array into a string */
const name= "Shirshak Kandel"
const nameWithDash=name.split(" ").join("-")
console.log(nameWithDash);//Shirshak-kandel