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 Loops, Arrays and Objects Tracking Multiple Items with Arrays Removing Items from an Array

Help with question

It's telling me error but don't know what I did wrong. Am I'm missing something?

script.js
var orderQueue.shift= ['1XT567437','1U7857317','1I9222528'];
var shipping ('1XT567437');
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
Arafat Patwary
Arafat Patwary
10,233 Points

https://teamtreehouse.com/community/orderqueue-array This answer should help you. you need to run orderQueue as a function after you declare the Array.

2 Answers

  1. First create a new variable named shipping. var shipping
  2. Secondly we need to remove the first element of the array and add that first element to the variable shipping.
    • We can do this by using the .shift() method on our orderQueue array like so... shipping = orderQueue.shift(); *The .shift() method removes the first element in an array and returns that element.
Ben Reynolds
Ben Reynolds
35,170 Points

The values for both of the variables you'll create in this challenge should be set by calling the appropriate array method on orderQueue, see this video for a demonstration:

Removing items from an array