JavaScript split

JavaScript split method use to split string from a given separator

Syntax

string.split()

string.split(separator)

string.split(separator,limit)

string.split() method return array

Example

Browser support

Browser
Versionyes
yes
yes
yes
yes

Parameter Details

Parameter
Description
SeparatorOptional - Separator is a pattern that describe where string should be occure
LimitOptional - Limit specify the number of string to be include in the array
limit should be non negative

Technical Details

Return value
It return array of substring

Use limit in split method

Example

Reverse string with split method

first split string with string.split('') and make reverse by reverse function and in last join it

Example

Tips - You can reverse big string