Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Arrays Multidimensional Arrays Review JavaScript Arrays

Maria Patiño
Maria Patiño
4,922 Points

How to combine two arrays?

Say you have two arrays, itemsA and itemsB, and you want to combine them into a new array named allItems. Complete the code so that the new allItems array stores the elements from itemsA first, followed by the elements inside itemsB

Please help ?????

1 Answer

Steven Parker
Steven Parker
221,323 Points

There are a few ways to do this, but since the quiz has 2 blanks already enclosed in brackets they probably want you to use the technique that was shown in the Copy and Combine Arrays with the Spread Operator lesson.

Take a look at that part of the video if you need a refresher.