Join the elements of an array into a string:
The result of energy will be:
More "Try it Yourself" examples below.
The join() method joins the elements of an array into a string, and returns the string.
The elements will be separated by a specified separator. The default separator is comma (,).
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
join() | 1.0 | 5.5 | 1.0 | Yes | Yes |
Parameter | Description |
---|---|
separator | Optional. The separator to be used. If omitted, the elements are separated with a comma |
Return Value: | A String, representing the array values, separated by the specified separator |
---|---|
JavaScript Version: | 1.1 |
Try using a different separator:
The result of energy will be: