Tell us what’s happening:
The answer is correct, I copied it from the Guide, and yet the tests fail…
// running tests
nextInLine([], 5) should return a number.
nextInLine([], 1) should return 1
After nextInLine(testArr, 10), testArr[4] should be 10
// tests completed
Your code so far
function nextInLine(arr, item) {
// Your code here
arr.push[item];
return arr.shift(); // 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; CrOS x86_64 12105.31.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.24 Safari/537.36
.
Link to the challenge:
javascript-algorithms-and-data-structures/basic-javascript/stand-in-line