- 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.
- If you omit the second index then, Split() function will start from the beginning and continue till end.
In this split string function example, First, we declared the String variable Str1 and assigned corresponding value using following statement
var Str1 = "We are Abc working in abc company since abc years";
The following statement will split the original string into individual characters
var Str2 = Str1.split("");
var Str3 = Str1.split(" ");
Next, We used the second argument to restrict the array output to four.
var Str4 = Str1.split(" ", 4);
var Str5 = Str1.split(/abc/i);
Thank You for Visiting Our Blog