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
1var a = ['Wind', 'Water', 'Fire'];
2a.join(); // 'Wind,Water,Fire'
3a.join(', '); // 'Wind, Water, Fire'
4a.join(' + '); // 'Wind + Water + Fire'
5a.join(''); // 'WindWaterFire'
1const cities = ['London', 'Paris', 'Tokyo'];
2const joinedCities = cities.join('-');
3
4console.log(joinedCities); // London-Paris-Tokyo
5
1
2const elements = ['Fire', 'Air', 'Water'];
3
4console.log(elements.join());
5// expected output: "Fire,Air,Water"
6
7console.log(elements.join(''));
8// expected output: "FireAirWater"
9
10console.log(elements.join('-'));
11// expected output: "Fire-Air-Water"