)
}
}
)
(
}
{
)
)
(
)
(
(
{
}
)
(
)
}
)
)
{
(
(
)
)
}
)
(
}

Combine Two or More Arrays

  1. const numbers = [1, 2, 3];
  2. const letters = ['a', 'b', 'c'];
  3. const symbols = ['!', '@', '#'];
  4.  
  5. // use spread operator
  6. const combined = [...numbers, ...letters, ...symbols];
  7. console.log('first', combined);
  8.  
  9. // older way
  10. const combinedConcat = numbers
  11.   .concat(letters)
  12.   .concat(symbols);
  13.  
  14. console.log('second', combinedConcat);

If you click “Try it out” be sure to open your console.

snippet.zone ~ 2021-24 /// {s/z}