Hello- My program returns the required response, but the course is not giving me credit for - “nextInLine([5,6,7,8,9], 1) should return 5”
I’ve spent awhile on this and have done a web search to get this far. Can someone please give me a clue as to what I’m missing?
Thank you
Your function parameters are arr and item yet you’re using push() and shift() methods on testArr.
My solution
function nextInLine(arr, item) {
arr.push(item);
return arr.shift(); // Change this line
}
var testArr = [1,2,3,4,5];
Thanks, it worked!
I’d tried … item =arr.shift();… and was getting arr.shift() is not a function so I used testArr instead. Thanks again for the help.