JavaScript Массив join()
Examples
const fruits = ["Банан", "Апельсин", "Яблоко", "Манго"];
let text = fruits.join();
Try it Yourself »
Another separator:
const fruits = ["Банан", "Апельсин", "Яблоко", "Манго"];
let text = fruits.join(" и ");
Try it Yourself »
Description
The join()
method returns an array as a string.
The join()
method does not change the original array.
Any separator can be specified. The default is comma (,).
Syntax
array.join(separator)
Parameters
Parameter | Description |
separator | Optional. The separator to be used. Default is a comma. |
Return Value
Type | Description |
string | The array values, separated by the specified separator. |
Array Tutorials:
Browser Support
join()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |