Welcome to the Treehouse Community
Looking to learn something new?
Why isn't this working?
I'm not sure why I don't see the solution to this. Is it sleep deprivation? Too much coding? The glass of wine I have sitting next to me right now?
Whatever the reason, this simple challenge has stumped me. What am I doing wrong?
var orderQueue = ['1XT567437','1U7857317','1I9222528']; var firstItem = orderQueue.shift(); var shipping = [firstItem];
Robert Bennett11,927 Points
test question answer.
var orderQueue = ['1XT567437','1U7857317','1I9222528']; var shipping = orderQueue.shift(); var cancelled = orderQueue.pop();
Test Question BIG hint. on why it works...
The challenge is asking you to store the first item from the array into the shipping variable. You would use the .shift() method to do that. It returns the first value from the array. For example, say you had an array like this:
var a = [1,2,3];
And you want to get the first item from that array and store it in a variable named first. You'd do this:
var first = a.shift();