The JavaScript split() String Method

By: Dusty Arlia
Published on Wednesday, April 3, 2013, 06:10 PM
Last Updated on Thursday, July 16, 2015 at 8:25 PM
Total Updates: 2

The JavaScript split() string method is used to split a string into an array of substrings and returns a new array. The original string is not modified. If an empty string ("") is passed to the split() method, then the string is split between each character.

For example:

var example_string = "Split me up!";
var returned_array_of_substrings = example_string.split("");
document.write(returned_array_of_substrings);

This example prints "S,p,l,i, ,m,e, ,u,p" to the screen.

Comments:

Ad: