split js array code example

Example 1: string split javascript

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']
*
*/

Example 2: split array javascript

// Returns new array from exising one
arr.slice(start, end);

Example 3: javascript split

var arr = ['hey', 'nay', 'wey'];
var let = arr.split(' ');
console.log(let);

Example 4: HOW TO SPLIT AN ARRAY JAVASCRIPT

array.splice(index, number, item1, ....., itemN)

Example 5: split() javascript

// It essentially SPLITS the sentence inserted in the required argument
// into an array of words that make up the sentence.

var input = "How are you doing today?";
var result = input.split(" "); // Code piece by ZioTino

// the following code would return as
// string["How", "are", "you", "doing", "todaY"];

Tags:

Php Example