Here’s my code:
function nextInLine(arr, item) {
// Your code here
arr.push(item);
var removed = arr.splice(0, 1);
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));
I was able to submit it by using shift() instead of splice, but I’m still confused. Does anyone know what’s going on here? How come FCC wasn’t registering my code as correct?