Split string into array

join to convert an array into a string

Array has method join which converts the contents of an array into a String.

Run the code below and you will see result as icecreamchocolatemovies. This does not look right. Scroll down to see the right solution.

In order to fix the issue with join we need to tell join to add space between the words as shown below.