how to add spaces between array items javascript how to add spaces between array items javascript javascript javascript

how to add spaces between array items javascript


the array.join function takes an optional delimiter parameter which will seperate the elements by the delimiter. A simple example:

var showtimes = ["1pm", "2pm", "3pm"];var showtimesAsString = showtimes.join(', '); // gives "1pm, 2pm, 3pm"