“Únete a JavaScript” Código de respuesta

matriz de javascript a una cadena separada por coma

var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(","); //"red,blue,green"
Grepper

.Join en JavaScript

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"
Batman

JS Únete

//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"
mikelikestocode

JS se une a la matriz

let array = [0, 1, 2, 3, 4, 5];
/*
Array.prototype.join(separator);
Returns a string version of the array with
the input separator between each element.
*/
var string = array.join("");
console.log(string); // -> 012345
MattDESTROYER

Únete a JavaScript

/* split methods splits string object into array of strings  
and join method changes element of array into a string */
const name= "Shirshak Kandel"
const nameWithDash=name.split(" ").join("-")
console.log(nameWithDash);//Shirshak-kandel
Sab Tech

JS Únete


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"
Impossible Iguana

Respuestas similares a “Únete a JavaScript”

Preguntas similares a “Únete a JavaScript”

Más respuestas relacionadas con “Únete a JavaScript” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código