JavaScript Objects The Strings Object- split() - Javascript Objects

What is JavaScript String - split() Method?

This method splits a String object into an array of strings by separating the string into substrings.

Syntax

The syntax is as follows −

Argument Details

separator − Specifies the character to use for separating the string. If separator is omitted, the array returned contains one element consisting of the entire string.

limit − Integer specifying a limit on the number of splits to be found.

Return Value

The split method returns the new array. Also, when the string is empty, split returns an array containing one empty string, rather than an empty array.

Example

Try the following example.

Output

Apples,are,round,


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Javascript Objects Topics