string splitting javascript code example
Example 1: string split javascript
var myString = "An,array,in,a,string,separated,by,a,comma";
var myArray = myString.split(",");
Example 2: split javascript
var str = "12,15,16,78,59";
var res = str.split(",");
console.log(res[0]);
console.log(res[2]);
Example 3: javascript split
var arr = ['hey', 'nay', 'wey'];
var let = arr.split(' ');
console.log(let);
Example 4: how to saperate string to array
Scanner in=new Scanner(System.in);
String input=in.nextLine();
String[] word=input.split(" ");