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 Store Multiple Values in an Array Remove Elements From an Array

Regarding the next challenge, i can't find the right solution. Help

I tried 2 approaches and they worked in Visual Studio Code, but the test won't accept it. Can someone tell me what i am doing wrong?

const orderQueue = ['1XT567437','1U7857317','1I9222528']; const shipping = [orderQueue.shift()];

Or: const orderQueue = ['1XT567437','1U7857317','1I9222528']; const item = orderQueue.shift() const shipping = [item];

1 Answer

Martin Sole
Martin Sole
80,285 Points

Hi

As you are calling a JS Method on an array you don't need to wrap this in square brackets, so for example arrayName.pop() doesn't need square brackets around it. You almost have the correct answer in both examples, just in the first it is inside square brackets and in the second example it is assigned to the variable 'item'.