## 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.

# Removing items from arrays Challenge Task 1

Hi can can any one help am stuck on the first challenge question for this video.

The orderQueue array contains a list of customer orders. Create a new variable named shipping -- remove the first item from the array and place it in the shipping variable. "

The error am getting

Bummer! It doesn't look like you stored the first item from the array in the shipping variable.

My Code.

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

Hi Chris Harkin!

The challenge:

1) The orderQueue array contains a list of customer orders.

```var orderQueue = ['1XT567437','1U7857317','1I9222528'];
```

2) Create a new variable named shipping

```var shipping;
```

3) Remove the first item from the array and place it in the shipping variable.

• Here is where you have the error, you're passing nothing to the shift function, and you're not even saving it inside the shipping variable:
```orderQueue.shift();
```
• This is how you save the first item of the list inside the shipping varible. You're passing to the shift function the index 0 (which represents the first item in the array).
```var shipping = orderQueue.shift([0]);
```

I hope this helps you to understand the challenge :)

PLUS

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

// this one should work

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

Is not working. Why

You're doing it outside the variable, just declare the shipping variable and use the method shift for the orderQueue array inside of it like:

`var shipping = orderQueue.shift();`

This is the correct solution!

```const orderQueue = ['1XT567437','1U7857317','1I9222528'];
var shipping = orderQueue.shift(); // Challenge Task 1
var cancelled = orderQueue.pop(); // Challenge Task 2
```

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

Try using the shift method on the variable itself rather than calling it in the global namespace.

but my example should also result in the same output

I try this and for some reason it didn't work. var hold = orderQueue.shift(); var shipping = [hold];

But I think this should work var shipping = [orderQueue.shift()]; Because shift return a value.