javascript string splut code example

Example 1: javascript explode

//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");

Example 2: 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: