Tell us what’s happening:
Hi guys,
From my output, I seem to fulfill all the conditions of the task but it looks like the site doesn’t recognize my code as correct. Maybe I’m wrong? I believe first off that the site sees my return as a string and not as a number but I don’t understand why.
I would appreciate any help I can get with this.
**Your code so far**
function nextInLine(arr, item) {
// Only change code below this line
var removedElement = arr[0];
arr.push(item);
arr.shift();
return removedElement;
// Only change code above this line
}
// Setup
var 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/89.0.4389.128 Safari/537.36
.
Challenge: Stand in Line
Link to the challenge: