This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

join

Summary

Adds all the elements of an array separated by the specified separator string.

Syntax

join([ separator ])
separator
Optional. A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

Examples

The following example illustrates the use of the join method.

var a, b;
 a = new Array(0,1,2,3,4);
 b = a.join( "-" ) ;
 document.write(b);

 // Output:
 // 0-1-2-3-4

Remarks

If any element of the array is undefined or null , it is treated as an empty string.

See also

Specification

15.4.4.5 Array.prototype.join (separator) ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

  • Microsoft Developer Network: Article