Basic JavaScript - Stand in Line

the test needs my nextInLine([5,6,7,8,9], 1) to return 5 and after nextInLine(testArr, 10), testArr[4] should be 10.

  **Your code so far**
function nextInLine(arr, item) {
// Only change code below this line
arr = arr.push(item)
let firstElemRemoved = [arr].shift()
return firstElemRemoved 
// arr.push(item); 
// console.log(arr) // const removed = arr.shift();
//console.log(removed) // return removed;
// Only change code above this line

// Setup
const testArr = [5, 6, 7, 8, 9];

// Display code
console.log(nextInLine([5,6,7,8,9], 1));
console.log(nextInLine(testArr, 10), testArr[4]);
  **Your browser information:**

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

Challenge: Basic JavaScript - Stand in Line

Link to the challenge:

Hello there.

Please Tell us what’s happening in your own words.

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

Also, the more information you give us, the more likely we are to be able to help.

I removed the comments from the function you posted to make it simpler to read:

function nextInLine(arr, item) {
  arr = arr.push()
 //  console.log(arr)
  const removed = arr.shift()
  return item;

Would you tell us, what arr.push returns, please?

Then, we can move onwards.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.