Tell us what’s happening:
Hi,
I’m feeling like I have a learning disability or something because I could recognize that .push() and .shift() were going to be in play, however, I can’t seem to make the preschooler leap to incorporate the line “var removed = arr.shift();”.
Is this a normal type of issue when it comes to noobs? I’m started to doubt if I can really do this if I can’t even figure this out. I ended up working through the hints for about an hour until finally caving and just looking at the answer which is so defeating.
When reading the instructions are they clear as day for people or am I the only one who just didn’t get it?
Your code so far
function nextInLine(arr, item) {
// Your code here
arr.push([], 5);
arr.shift([], 1);
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));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/stand-in-line