Basic JavaScript - Stand in Line

function nextInLine(arr, item) {

// Only change code below this line

arr.push(item)

return arr.shift(item);

// Only change code above this line

}

// Setup

let testArr = [1, 2, 3, 4, 5];

// Display code

console.log("Before: " + JSON.stringify(testArr));

console.log(nextInLine(testArr, 9));

console.log("After: " + JSON.stringify(testArr));

Welcome to FCC Forum @Hettdo !

Please tell us what the problem is in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

Happy coding!