1const elements = ['Sun', 'Earth', 'Moon'];
2
3console.log(elements.join());
4// output: "Sun,Earth,Moon"
5
6console.log(elements.join(''));
7// output: "SunEarthMoon"
8
9console.log(elements.join('-'));
10// output: "Sun-Earth-Moon"
1//turns array to string
2
3const elements = ['Fire', 'Air', 'Water'];
4
5console.log(elements.join());
6// expected output: "Fire,Air,Water"
7
8console.log(elements.join(''));
9// expected output: "FireAirWater"
10
11console.log(elements.join('-'));
12// expected output: "Fire-Air-Water"
13
1const cities = ['London', 'Paris', 'Tokyo'];
2const joinedCities = cities.join('-');
3
4console.log(joinedCities); // London-Paris-Tokyo
5
1<html>
2 <select multiple class="select-colors">
3 <option>blue</option>
4 <option>green</option>
5 </select>
6</html>
7
8<script>
9 var myColorSelect = $(".select-colors").val().join();
10
11 console.log(myColorSelect);
12</script>