The join()
method creates
a string that contains
all the elements of an array.
join()
takes one argument
that is used as the separator.
The separator is inserted between
all the elements that are inserted
into the string returned by join
.
In the example given above,
fruits.join(",")
returns a string that contains
all the elements of fruits
,
separated by ","
.
If an array contains - undefined
,
null
or []
(empty array),
the join
method inserts
empty strings ""
instead
of them.