Copyright © tutorialspoint.com

Javascript String - split() Method

previous next

Advertisements


Description:

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

Syntax:

string.split([separator][, limit]);

Here is the detail of parameters:

Return Value:

Example:

<html>
<head>
<title>JavaScript String split() Method</title>
</head>
<body>
<script type="text/javascript">

var str = "Apples are round, and apples are juicy.";

var splitted = str.split(" ", 3);

document.write( splitted );

</script>
</body>
</html>

This will produce following result:

Apples,are,round, 

To understand it in better way you can Try it yourself.


previous next

Copyright © tutorialspoint.com