Tell us what’s happening:
Describe your issue in detail here.
Hello to all. Hope you are having a nice day.
I am facing challenges proceeding with this assignment beyond the point where shifting the initial element in the array returns an answer of 1. I am unable to pass the subsequent 3 tests as I do not know how to articulate the solution. Having edited the array the first two times I don’t know what is required as the same statement does not seem to work when I attempt arr.shift(2) like I did for shifting 1 from the front of the array.
Kindly help me to make sense of this.
Your code so far
function nextInLine(arr, item) {
// Only change code below this line
([1, 2, 3, 4, 5], 6);
arr.push(6);
console.log(arr);
arr.shift(1);
console.log(arr);
arr.shift(2);
console.log(arr);
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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 OPR/95.0.0.0
Challenge: Basic JavaScript - Stand in Line
Link to the challenge: