Tell us what’s happening:
can someone help me understand how I could do this please? I am so confused by this question.
here is the question
Write a function nextInLine which takes an array (arr) and a number (item) as arguments.
Add the number to the end of the array, then remove the first element of the array.
The nextInLine function should then return the element that was removed.
function nextInLine(arr, item) {
// Your code here
return item([2],1); // Change this line
}
// Test Setup
var testArr = [1,2,3,4,5];
// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log([2],1); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));