Answers for "js array join"

28

javascript join array

var array = ["Joe", "Kevin", "Peter"];
array.join(); // "Joe,Kevin,Peter"
array.join("-"); // "Joe-Kevin-Peter"
array.join(""); // "JoeKevinPeter"
array.join(". "); // "Joe. Kevin. Peter"
Posted by: Guest on May-20-2020
37

join array js

const elements = ['Sun', 'Earth', 'Moon'];

console.log(elements.join());
// output: "Sun,Earth,Moon"

console.log(elements.join(''));
// output: "SunEarthMoon"

console.log(elements.join('-'));
// output: "Sun-Earth-Moon"
Posted by: Guest on July-25-2020
16

js join

//turns array to string

const elements = ['Fire', 'Air', 'Water'];

console.log(elements.join());
// expected output: "Fire,Air,Water"

console.log(elements.join(''));
// expected output: "FireAirWater"

console.log(elements.join('-'));
// expected output: "Fire-Air-Water"
Posted by: Guest on March-17-2020
2

join in array

var a = ['Wind', 'Water', 'Fire'];
a.join();      // 'Wind,Water,Fire'
a.join(', ');  // 'Wind, Water, Fire'
a.join(' + '); // 'Wind + Water + Fire'
a.join('');    // 'WindWaterFire'
Posted by: Guest on September-28-2020
1

join javascript array

const cities = ['London', 'Paris', 'Tokyo'];
const joinedCities = cities.join('-');

console.log(joinedCities); // London-Paris-Tokyo
Posted by: Guest on May-31-2021
0

js array join

['h', 'e', 'y'].join('')
// hey
Posted by: Guest on July-22-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language