Adds all the elements of an iterable into a string, separated by the specified separator string.
Time complexity: O(n)
Space complexity: O(n)
The iterable to join
A string used to separate one element of the iterable from the next in the resulting string
A string containing the elements in iterable joined by separator
Iterable
join(['a', 'b', 'c']); // 'a,b,c' Copy
join(['a', 'b', 'c']); // 'a,b,c'
join(['a', 'b', 'c'], '-'); // 'a-b-c' Copy
join(['a', 'b', 'c'], '-'); // 'a-b-c'
Adds all the elements of an iterable into a string, separated by the specified separator string.
Time complexity: O(n)
Space complexity: O(n)