How to do the Stand In Line challenge?

How to do the Stand In Line challenge?
0.0 0

#1

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!


Stand in Line: How to complete this challenge?
Stand in Line: How to complete this challenge?
#2

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?


#3

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.


#4

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.

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.

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.

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.


#5

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.


#6

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.


#7

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.


#8

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.


#9

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?


#10

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.


#11

Did you read:

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.


#12

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?


#13

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

You can do this challenge with these functions.





#14

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?


#15

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


#16

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?


#17

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


#18

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.


#19

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.


#20

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?