Doubt for the topic

*How to solve this issue
1> * nextInLine([2], 1) should return 2

*2>Failed:nextInLine([5,6,7,8,9], 1) should return 5

  **Your code so far**
function nextInLine(arr, item) {
// Only change code below this line
arr.push(item);
 const removed = arr.shift();
return testArr.shift(2);
// Only change code above this line
}

// Setup
const testArr = [1, 2, 3, 4, 5];
testArr.pop();




// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

Challenge: Stand in Line

Link to the challenge:

What is this doing for you?

You saved the result of the first shift to a variable, removed, but then never used that variable. What was your intention for saving it to a variable?

function nextInLine(arr, item) {
// Only change code below this line
arr.push(item);

return testArr.shift();
r
// Only change code above this line
}

// Setup
const testArr = [1, 2, 3, 4, 5];

Will this be right?

How to get this please ? nextInLine([2], 1) should return 2

You shouldn’t use the global variable at all

Thank you so much for helping me out.

And for this ?
nextInLine([5,6,7,8,9], 1) should return 5

All of the tests should pass if you never use the global variable and instead only use the function arguments.