/

HTML / CSS / JavaScript Tutorial

JavaScript String method: split()

[this page | pdf | back links]

The split() method (when applied to a JavaScript string) returns an array of substrings that are created by splitting the original string using a given delimiter.

 

It has the following syntax with the following parameters:

 

string.split(delimiter,limit)

 

Parameter

Required / Optional

Description

delimiter

Optional

Separator used to delimit individual entries. If the delimiter is "" (i.e. an empty string) then the string is split between each character. If the delimiter is not present then split does not affect the original string

limit

Optional

An integer specifying maximum number of splits (items after the limit will not be included in output array)

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript String Variables


Desktop view | Switch to Mobile