Whats wrong on my code? in Stand in Line1

Tell us what’s happening:

Your code so far


function nextInLine(arr, item) {
  var array = arr.push(item);
  var itemTest = array.shift();
  return itemTest; 
}

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

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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 OPR/54.0.2952.54.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/stand-in-line/

Push isn’t doing what you think it’s doing

You’re right in thinking it adds an element to the array, however it doesn’t return the array, it just returns the length of the new array which is a number

Therefore shifting a number doesn’t work