here is what it gives.
function nextInLine(arr, item) {
// Your code here
return item; // 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));
I did figure out the answer i’m just wondering why if I use
function nextInLine(arr, item) {
// Your code here
var remo=arr.shift();
arr=arr.push(item);
[spoiler]
//arr.push(item);
//return arr.shift();
[spoiler]
return remo; // 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));
it doesn’t pass and if i put the shift after the push i get TypeError: arr.shift is not a function the only difference to me is i’m trying to store the value before returning it.