Javascript string split() is an inbuilt function that splits the String object into an array of strings by separating a string into substrings, using a specified separator string to determine where to make each split. The string split() function is used to split the given  string into an  array of strings by separating it into substrings using a specified separator provided in the argument.

Javascript string split() method returns a new array. At each match of the separator .split() method will split the string and add the split section as an element to an array.

Javascript string split example

If an empty string (”) is used as the separator, the string is split between each character. The string split() method does not change an original string. The syntax for the split() method is the following.

string.split(separator, limit)

The separator is an optional parameter. The separator specifies a character, or a regular expression, to use for splitting a string. If omitted, then the entire string will be returned.

The limit is an optional parameter. It is an integer that specifies the number of splits, items after the split limit will not be included in the array.

#javascript #string.prototype.split #js

Javascript String Split Example | String.prototype.split()
2.55 GEEK