Stand in Line. Learn basic javascript

Can someone please please help me with the Stand in Line section of the Basic Javascript challenge( its number 55 in the first section). I really dont understand it.

What part don’t you understand? How can we help?

Could you please provide a link to the challenge?

Hi @hedwigniemann !

I have edited your post to include the challenge link.
In the future, it is always best to include the links so people can see the problem for themselves.

Let’s break down the problem
Here is the first part
Add the number to the end of the array,

You recently learned about an array method where you can add elements to the end of arrays so I would review that lesson and incorporate that into your code.

Here is the second part
then remove the first element of the array.
You also learned about an array method on how to remove elements from the beginning of arrays.

Hope that helps!

The task is looking for you to use push() to add item to the end of the array and shift() to remove the first item.

The answer has already been given to you but an important part of becoming a developer is research.

For example, if you were confused about how to add elements to the end of the array then you can google that and the first few results will give you the answer.

You can also google how to remove the first element from the beginning of the array.

Learning how to research will make you a much stronger developer :smiley:

When I learned about arrays (a very loong time ago now) the visual tool used for the class was a series of marbles sitting in a line in a slot. You could add or remove marbles from either end…

Something like this:

The important thing is that (in the contect of push,pop,shify,unshift) the order of the marbles doesn’t change, only the ends can be added to or removed. (NB: Other methods can be used to change individual elements in the array)

In the current lesson the array is free to grow by adding an item and then shrink by removing one using the methods described.

The marble analogy becomes more useful if you ever progress to FIFOs and shift registers, where the slot is a specific size and can only hold a specific number of marbles, but thats something for the future…


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.