Hello fellow campers!
So far I have been having a blast learning the fundamentals of web development here on Free Code Camp as a newbie. It’s been tough as FFC is known to not hold your hand, essentially forcing you to think. However, I seem to have met my match with this relatively basic assignment.
I have spent upwards of 4 hours trying to solve this assignment; primarily because the wording of the assignment was perceived as vague and esoteric at best. I simply didn’t comprehend what was being asked of me and understood even less of what I was EXPECTING to achieve via the checklist requirements. In those hours I DID manage THIS solution:
function nextInLine(arr, item) {
arr = testArr;
item = testArr.shift();
testArr.push(item);
return item;
But it does not satisfy the entirety of the checklist requirements. Finally I decided to look up the answer on here with the intention of studying as to why it is the correct code. I’m STILL lost. I don’t know WHY it is correct and I still don’t see how it all relates. The console.logs confused me too. I just wish there was slightly more context. It feels like I am simply missing something and I can’t pinpoint why.
If any of you guys have time, would you please explain this assignment and WHY it is correct in a more laymen style that even a two-year-old could understand? I appreciate any input as I know you’re all busy.