Join the elements of an array into a string:
The result of energy will be:
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 join() method is supported in all major browsers.
| Parameter | Description |
|---|---|
| separator | Optional. The separator to be used. If omitted, the elements are separated with a comma |
| Type | Description |
|---|---|
| String | The array values, separated by the specified separator |
| JavaScript Version: | 1.1 |
|---|
Try using a different separator:
The result of energy will be:
JavaScript Array Object
Your message has been sent to W3Schools.