JavaScript Basics
JavaScript Objects
JavaScript Advanced
JS Useful References
JS Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Javascript Array join() Method
Description:
Javascript array join() method joins all elements of an array into a string.
Syntax:
Here is the detail of parameters:
Return Value:
Returns a string after joining all the array elements.
Example:
<html>
<head>
<title>JavaScript Array join Method</title>
</head>
<body>
<script type="text/javascript">
var arr = new Array("First","Second","Third");
var str = arr.join();
document.write("str : " + str );
var str = arr.join(", ");
document.write("<br />str : " + str );
var str = arr.join(" + ");
document.write("<br />str : " + str );
</script>
</body>
</html>
|
This will produce following result:
str : First,Second,Third
str : First, Second, Third
str : First + Second + Third
|
To understand it in better way you can Try it yourself.
|
|
|