I got the code correct through the help section but didn’t understand how these come about; 1. how the argument function should contain ‘(arr, item)’ instead of ‘(arrItem)’
2. how the shift code has only ‘arr.pusg(item)’ instead of ‘testArr.push(item)’
3. how the push code has ‘return arr.shift(item)’ instead of ‘return testArr.shift(item)’
4. how and where we get the console.log code from because i don’t understand how it was defined.
PLEASE LET SOMEONE HELP ME TO EXPLAIN THEM, THANKS.
**Your code so far**
function nextInLine(arr, item) {
// Only change code below this line
arr.push(item)
return arr.shift();
// Only change code above this line
}
// Setup
const 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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36 Edg/101.0.1210.32
Challenge: Stand in Line
Link to the challenge: