Stand in Line Tutorial

Tell us what’s happening:
Please guys, I had to stop this tutorial all because of this challenge. Help me out, I’m lost.

Your code so far

function nextInLine(a, b) {
  // Your code here
  a = 12;
  b = 4;
  a + 1 = b;
  return b;  // Change this line

// 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));

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0.

Link to the challenge:

There are a number of issues with your code, but the biggest issue is that you don’t seem to understand what the assignment is. You need to add a value to an array and return a value that you remove from the array.

1 Like

please what can I do. TBH I don’t understand this chapter.

If you can not remember how to add an element to the end of an array or how to remove an element from the beginning of an array, I suggest you review the following previous challenges:


Thanks to everyone that contributed. I got it. This was the code I used, tho’ I looked it up on the net: function nextInLine(arr, item) { // Your code here arr.push(item); const shifted = arr.shift(); return shifted; // Change this line }