JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Removing Items from an Array

Definiti Media
Definiti Media
11,563 Points

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

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

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

1 Answer

Sean T. Unwin
Sean T. Unwin
28,651 Points

We just need the String of the first value, not an Array. Remove the square brackets surrounding the shift() call.