# How to do the Stand In Line challenge?

Okay, this is a perfect example of FCC being HORRIBLE at explaining what to do and how to do it lol. This challenge is impossible, I have no idea where to even start. Im pretty sure the reason I cant figure it out is because NOTHING IS EXPLAINED as far as how to do it!

What specifically do you not understand? Do you not understand what the instructions are asking you to do to pass the challenge or do you just not understand what code to write?

Thereâ€™s no instructions at all. Their â€śinstructionsâ€ť are just guidelines of what theyâ€™d like the outcome to be. Rather than an explanation on how to do it. In addition, the instructions assume that total beginners already know what their doing but Iâ€™ll tell ya, Iâ€™m looking at this code and I have no idea where to even start. My apologies for sounding â€śrudeâ€ť but its frustrating.

That is the part you must figure out. You have already learned about arrays and you have already learned about functions which can be used on arrays. First, you should develop an algorithm (written or pseudo-code). The algorithm will map out the steps your code will need to do to solve the challenge. The instructions pretty much give you the algorithm:

Step 1) Add the number to the end of the array. In a previous challenge, you already were exposed to a function which will do this. If you do not remember, I suggest reviewing the following challenge.
https://www.freecodecamp.org/challenges/manipulate-arrays-with-push

Step 2) Remove the first element of array. In a previous challenge you already were exposed to a function which will do this. If you do not remember, I suggest reviewing the following challenge.
https://www.freecodecamp.org/challenges/manipulate-arrays-with-shift

Step 3) The function should then return the element that was removed. You have already been shown how to return values from functions in a previous challenge. If you do not remember, then I suggest reviewing the following challenge.
https://www.freecodecamp.org/challenges/return-a-value-from-a-function-with-return

The challenges from here on out will slowly introduce you to a few more functions/concepts, but you will be expected to use what you have already learned to solve the challenges. The instructions are not going to give you a step by step of writing the code. That is part of the challenge. Otherwise, they would have just created a video and you would have watched one personâ€™s vision of how to solve the challenge. That is not how FCC works. It is designed to teach you just enough to get your started and then most of the time, you must do research on your own to figure out what pieces you are missing to accomplish a specific task at hand. However, I would say for the Basic JavaScript, Basic and Intermediate Algorithm sections, you will have already seen 99% of the material which would allow you to solve the challenges in some way. In the Advanced Algorithm section, you will probably have to do some extra research.

Lastly, FCC uses the Read, Search, and Ask methodology. When all else fails after reading the challenge instructions, reviewing over previous challengesâ€™ material, and searching the Internet for more info, you can always pose a question on the forum about what you are having trouble with. We do are best to answer your question without just â€śgivingâ€ť you the code. We feel it is a better learning experience if we give you hints and let you feel some satisfaction of solving the challenge by yourself.

Okay understandable and thank you for the explanation, although I think it would be wise for FCC to display that info somewhere then. Because Iâ€™m not the only user whose had this problem with FCC. I think the main issue here is thereâ€™s only 1 instance of each challenge. For example in 1 challenge, you do 1 and learn 1 thing, and then the next challenege you do 1 and learn 1 other thing. The lessons do not build onto one another, and only being able to practice 1 lesson with 1 problem, thatâ€™s not going to help a beginner understand whatâ€™s actually going on. Nor does it help develop the necessary mindset that one needs in order to perform these kind of tasks.

This is one of the first challenges where you start putting the learnings from previous challenges into practice. The previous challenges exposed one thing at a time, because those functions/concepts could be mutually exclusive. When you learn about a specific function, the function only has one specific task, so there is not much else to combine, which is why they have challenges like the one your are currently working on.

There are other sites out there which give you a little more â€śinstructionâ€ť the way you are wanting FCC to do, but I have always found most of those sites which show you exactly what to code do not really allow you to think on your on. FCC definitely makes you think and I that is why I stuck with it. Everyone learns differently and some have said they started FCC and then paused to take some video classes or read some outside blogs to get more instruction before coming back to FCC to finish it.

Okay, no that makes total sense actually. I appreciate you taking the time to help me out here with this challenge. I just did some research on how to complete each step and Iâ€™ve got a better understanding now. Also, Iâ€™ts free education so I guess I canâ€™t be too picky about these things. Thanks again.

1 Like

Iâ€™ll be honest, Iâ€™m still really stuck. Even after looking over the previous lessons for the push() method and everything, I still canâ€™t figure out what to start writing.

Below is my first step

nextInLine([2], 1) should return 2

Itâ€™s telling me what it â€śshouldâ€ť be, but how am I supposed to know what to actually start writing? Like how do you take a problem and automatically â€śknowâ€ť what to start writing to solve the problem?

Below is my first step

nextInLine([2], 1) should return 2

Itâ€™s telling me what it â€śshouldâ€ť be, but how am I supposed to know what to actually start writing? Like how do you take a problem and automatically â€śknowâ€ť what to start writing to solve the problem? Like do I start with a function or a variable or a loop or an if/else or how do you know what to start writing?

For example, the first step (above) says nextInLine([2], 1) but I donâ€™t even see where it says that or is displayed like that in the actual problem at all. This makes no sense literally at all.

In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

I would want to know the starting input and the finishing output before writing the code.

Yes I read it, but that still doesnâ€™t make any sense whatsoever. Your saying â€śI would want to know the starting input and the finishing output before writing the code.â€ť But whatâ€™s that supposed to mean exactly? Like how would you know how to start writing that in code?

From previous examples you should have been introduced to .pop, .push, .shift, .unshift.

You can do this challenge with these functions.

Yes and I understand them all and what they do as well. But that doesnâ€™t help when it comes to knowing how to start solving a problem, or how to start writing the code to solve the problem. Like do you start with a function or a loop or an if/else or what? Thats why Im confused, like how do you know what to actually start typing?

Test out the functions I mentioned and see what happens. That is what I did.

Okay but on line 6 it says â€śreturn itemâ€ť and then // change this code.

Plus its got a bunch of JSON.stringify stuff attached to it thats confusing the hell out of me as well, do I need to do anything with that stuff?

JSON stringify changes an object to a string for outputting to the screen or console.

Also, in the directions, this is my first thing I have to do (nextInLine([2], 1) should return 2). But none of that is in the problem at all so how am I supposed to know what to start with? Man, Im so fucking confused you have no idea.

nextInLine says nextInLine(arr, item) so im not sure where their getting the array from or the 2 and the 1.

So in the instructions:
The nextInLine function should then return the element that was removed.

From the documentation for `pop()`
The `pop()` method removes the last element from an array and returns that element. This method changes the length of the array.

From the documentation for `shift()`
The `shift()` method removes the first element from an array and returns that removed element. This method changes the length of the array.

PS.
The way FCC works is you are encouraged to read, search then ask.
This is because in a real job, you are expected to (eventually) do just that.

See man, your telling me this stuff but I already know all of this. But I dont think your understanding my problem. Okay so the actual 1st step is below:

nextInLine([2], 1) should return 2

Hereâ€™s my problem, that exact line is nowhere in the actual code at all, so where the hell are they getting the 2 and the 1 from?