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

744 B
Raw Blame History

title localeTitle
Combine Arrays with the Spread Operator Объединить массивы с оператором распространения

Объединить массивы с оператором распространения

  • Решение в точности соответствует приведенному примеру. Просто вставьте массив fragment[] массив sentence[] в нужном индексе.

Решение:

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());