Partager via


join Method (Windows Scripting - JScript)

 

Returns a string value consisting of all the elements of an array concatenated together and separated by the specified separator string.

Syntax

arrayObj.join([separator]) 

Arguments

  • arrayObj
    Required. An Array object.

  • separator
    Optional. A String object used to separate one element of an array from the next in the resulting String object. If omitted, the array elements are separated with a comma.

Remarks

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

The following example illustrates the use of the join method.

function JoinDemo(){
   var a, b;
   a = new Array(0,1,2,3,4);
   b = a.join("-");
   return(b);
}

Requirements

Version 2

Applies To: Array Object (Windows Scripting - JScript)

Change History

Date

History

Reason

March 2009

Modified introduction.

Content bug fix.

See Also

String Object (Windows Scripting - JScript)