Split a string into an array of strings in JavaScript

Definition and Usage
The split() method is used to split a string into an array of strings.

Syntax
stringObject.split(separator, howmany) 
separator Required.
Specifies the character, regular expression, or substring that is used to determine where to split the string

howmany Optional. Specify how many times split should occur. Must be a numeric value

Note: If an empty string ("") is used as the separator, the string is split between each character.

Sample code and demo is here

Demo

No comments:

Post a Comment