Syntax of split method : string.split(separator,limit)
These two parameters are optional.
Ok, now we will see how this method works:
var char_str="Hello this is a Method of spliting";
var char_array=char_str.split(" ");
Here the string will be splited by space (” “).
and output will like :
Now we can use the char_array variable as an array. where the value is located like =>’Hello’, =>’this’,=>is,=>’a’ …………………..
so if we use char_array then we will get “is”
See details about split method : split()