freeCodeCamp/guide/spanish/certifications/javascript-algorithms-and-d.../basic-data-structures/combine-arrays-with-the-spr.../index.md

591 B

title localeTitle
Combine Arrays with the Spread Operator Combina matrices con el operador de propagación

Combina matrices con el operador de propagación

  • La solución es exactamente igual al ejemplo dado. Simplemente inserte la matriz del fragment[] en la matriz de la sentence[] en el índice deseado.

Solución:

function spreadOut() { 
  let fragment = ['to', 'code']; 
  let sentence = ["learning", ...fragment, "is", "fun"]; // change this line 
  return sentence; 
 } 
 
 // do not change code below this line 
 console.log(spreadOut());