Absolutely Confused: Stand In Line

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();
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.

the only difference I see is in your solution if the array taken is empty you trigger an error, and in the correct answer if the array taken is empty return the item taken

non English native btw

Hey man I just wanted to than you for taking the time to explain that to me. I guess a major factor was that the variable and the console.logs may have confused me, thus causing me to overcomplicate what was actually a very simple challenge. Thank you sir. I understand this clearly now.

1 Like