Basic JavaScript - Stand in Line

Tell us what’s happening:
Describe your issue in detail here.
Pls can someone help me out.
Your code so far

function nextInLine(arr, item) {
  // Only change code below this line
  item = testArr.shift(5)
  return 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, 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/ Safari/537.36

Challenge: Basic JavaScript - Stand in Line

Link to the challenge:

Here are the challenges I couldn’t solve

  • nextInLine([2], 1) should return 2

  • Waiting:nextInLine([5,6,7,8,9], 1) should return 5

  • Waiting:After nextInLine(testArr, 10), testArr[4] should be 10

Pls I don’t understand the challenges.

Not your link :sweat_smile:, the challenges of my question. I already passed that one.

These are the remaining challenges.

I’ve removed it from the code.

This is the new code

  item = testArr.shift()
  testArr[4] = 10
  return item;

Thank you It isn’t suppose to be in the code. But it removes the last element of an array.

Sorry, I’m a bit confused now.

  item = testArr.shift()
  item = testArr.shift()
  item = testArr.shift()
  item = testArr.shift()
  item = testArr.shift()
  testArr[4] = 10
  return item;

Thank you very much :grin:.

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