Syntax
string.split(separator,limit)
Example 1
var str = "How are you doing today?";
var res = str.split();
The result of res will be an array with only one value:
How are you doing today?
Example 2
var str = "How are you doing today?";
var res = str.split("");
The result of res will be an array with the values:
H,o,w, ,a,r,e, ,y,o,u, ,d,o,i,n,g, ,t,o,d,a,y,?
Example 3
var str = "How are you doing today?";
var res = str.split(" ",3);
The result of res will be an array with only 3 values:
How,are,you
Example 4
var str = "How are you doing today?";
var res = str.split("o");
The result of res will be an array with the values:
H,w are y,u d,ing t,day?