When does JS start making sense?

When does JS start making sense?
0.0 0

#1

I’m about halfway through the basic javascript lessons on FCC and I’m wondering at what point will I understand the applications of arrays and pushing or shifting them? I think I’m having a hard time keeping all these functions straight because I don’t yet know the real-life uses for them, yet.


#2

Arrays, and Collections are Data Structures… so they’re used for keeping data.

What kind of data?

A practical example may be a shopping cart application. As the user adds item to their shopping cart, you keep track of the item they added and the sku or item ID#, and quantity. When they’re ready to submit their order, you send this data to the server for processing (i.e. look up price, multiply with quantity ordered, get subtotal, compute taxes, etc)… then the server sends a response back to the user this is your grand total, you’ll pay this much in taxes, and shipping charge is this amount.

So as the user adds or removes items, or update quantities in their shopping cart, you make the necessary adjustments to the data to reflect the user’s action.


#3

It starts making sense when you start building things using techniques you are learning doing algorithms and reading and doing research. Learning all this is a long game.


#4

As the other people said, it starts once you start using them for larger projects. The most important thing is to remember what to use when, and the overall concepts. These usually will be used day-to-day to tackle smaller problems within larger problems, so having good fundamentals with basic javascript is important to figure out how to approach the simplest problems, once you have broken down the larger problems.

I also mention concepts, as a you can carry over a lot of what you learn to other languages easily if you have a good grip of the concepts. (For example, an array in most languages are somewhat similar to JS arrays.)

Continue going through the basic lessons, and get to the high level challenges and you will end up using what you learn, so make sure you pay attention :grinning: