- String_Object: Please specify the valid string on which you want to perform Splitting.
- Limit: Please specify the integer number. This argument will restrict the number of elements written by the array.
The following set of examples will help you understand the string Split function.
The following JS string split statement will split the original string into individual characters
var Str2 = Str1.split("");
var Str3 = Str1.split(" ");
We used the second argument to restrict the array output to four.
var Str4 = Str1.split(" ", 4);
Next, we used substring “abc” as a separator for the Js Split string function. Here i is the regular expression to perform case insensitive search
var Str5 = Str1.split(/abc/i);