Easy Tutorial
❮ Jsref Toisostring Prop Element Offsetparent ❯

JavaScript join() Method

JavaScript Array Object

Example

Convert all elements in the array to a string:

energy Output result:


Definition and Usage

The join() method is used to convert all elements in an array into a string.

Elements are separated by a specified separator.


Browser Support

All major browsers support the join() method.


Syntax

Parameter Values

Parameter Description
separator Optional. Specifies the separator to use. If omitted, the comma is used as the separator.

Return Value

Type Description
String Returns a string. This string is generated by converting each element of the array to a string, then concatenating these strings, inserting the separator string between each element.

Technical Details

| JavaScript Version: | 1.1 | | --- | --- |


More Examples

Example

Using different separators:

energy Result output:


JavaScript Array Object

❮ Jsref Toisostring Prop Element Offsetparent ❯