I am trying to make sure I understand the core concepts of this exercise and value the educational journey of each individual so I am posting here instead of on the facebook group.
This question pertains to stand in line lesson 165.
Here is the code:
------------------------------------------------------
function nextInLine(arr, item) {
// Your code here
arr = ["chicken", "turkey", "sausage"];
item = 1;
arr.push(item);
var removed = arr.shift(0);
return removed;
}
------------------------------------------------------------------------
// Test Setup
var testArr = [1,2,3,4,5];
// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Why does the above not work, in comparison to the below:
(answer from the website)
function nextInLine(arr, item) {
// Your code here
arr.push(item);
var removed = arr.shift();
return removed; // Change this line
}