Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Arrays Multidimensional Arrays Review JavaScript Arrays

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
229,708 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.