Tell us what’s happening:
I’m failing the lesson test, and I don’t know why.
Your code so far
function nextInLine(arr, item) {
arr.push(item); // Your code here
return arr.unshift(arr[0]); // Change this line (already changed)
}
// 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));
function nextInLine(arr, item) {
arr.push(item);// Your code here
return arr.unshift(arr[0]); // 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: Google Chrome: Version 67.0.3396.99 (Official Build) (64-bit) , Windows 10 Pro.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/stand-in-line