Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Two-Dimensional Arrays

Mike McKnight
Mike McKnight
6,717 Points

I'm not really getting the point

I'm doing the front-end track and i'm getting near to the end, but I don't see the point in using most of the javascript we've covered. For example the section i'm on has been having us build a list of songs using javascript. Why would I not just make the list in HTML and avoid the headache of all these functions if literally all i'm doing is making a list?

Tyler Durden
Tyler Durden
2,406 Points

You can use the arrays for anything, from random generators to looping through classes via getElementsByClassName and probably an infinite amount of other things. Arrays are literally one of the most insanely useful data structures you will use in programming (there are others too, like LinkedLists, Queues, Stacks, Trees, but you'll see that in Data Structures).

Maybe if you just started programming you might overlook the power of arrays, but trust me my good friend, you will use arrays so much , especially in other programming languages when you build up programs/apps.

2 Answers

Caleb Taylor
Caleb Taylor
6,108 Points

What if you want an option to delete or add songs to the list when you visit the website? The thing about HTML is that it is static and if you make the list then it can't be changed on the browser. That's where JavaScript comes in, and keep going through the course and once you get to the DOM section things will make more sense. It's okay to feel overwhelmed and I recommend watching other videos on youtube alongside completing the course. You should watch Traversy Media on his JavaScript video on making a bookmark application.

In learning any programming language, sometimes you'll encounter some ideas that don't quite click until you run into a problem that needs that technique to fix it.

If you want to have a better understanding of what Javascript can do for you, I would always suggest going on and creating little programs yourself as well. There are lots of cool things people have done with JS, so take a look around the web and see how it's been used in other spots to get some inspiration.