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 Build a Quiz Challenge, Part 2 Solution

Blaize Lange
Blaize Lange
2,298 Points

Is it weird that I understand how the program works, but can't put together the code challenge at all?

I understand how each function, array, and loop work individually and even how they work together after I see them written out, but when it came time to building the quiz program challenge and using them all together from scratch I had a lot of trouble and had no idea where to start. I was thinking of re-watching some of the videos, but I really understand what functions, loops, and arrays do and how to write them which is 95% of the videos. Is there someway on treehouse I can just practice using them together in multiple situations or somewhere else for that matter?

7 Answers

Julian Laub
Julian Laub
1,982 Points

Understanding what you need to say to someone isn't the same as knowing the language to say it in. There is a different logic within the code than it shows when it works. So I think you need to think about the correlation of the different code building blocks.

There is so much more than how your program works. Why is there an array? why not an object? When is it accessed? How is it accessed? Where is it positioned? At the beginning. Why? For good overview, so the next coder sees them straight away. What is the point of the buildList function? To trigger a variable that prints text to the screen that resembles html and thus is being used like html. This way JavaScript can influence html properties, like position, colour etc. and then can access, the questions stored in the array, and display them on the screen in a way determined by the html string in the function.

So there is a sense to it all. And there is a lot to figure out. But if you see what connections there are within the code, you remember how to translate from practical idea to coding structure. And latter is what's it all about here.

Blaize Lange
Blaize Lange
2,298 Points

Good advise thank you. I just started and I think I am just a little impatient, but I'm getting there.

Hi Blaize,

All I can say is just start building. Build anything. Build and throw away if you want. Rinse and repeat. It doesn't have to be anything complicated. Start with something small and then you can refactor the code as you go. When you are working on a project divide it into smaller digestible pieces. Say you are a building a "To do" app. You might start with a form that adds items to the list. Do that. Don't think how to implement every single part of your program your mind might get overwhelmed.

The more you code the more information you retain. You can't read a French dictionary and suddenly start speaking fluent French. You practice.

Build something every day. Doesn't matter if you do it for 30 minutes or 10 hours. Keep coding keep building!

Try Codepen to practice JavaScript without spending too much time setting up dev environment.

Good luck and happy coding.

Blaize Lange
Blaize Lange
2,298 Points

Thanks Codepen looks really cool, I'll definitely sign up soon!

Julian Laub
Julian Laub
1,982 Points

Building, building, building is not the best way! The best way is to write down how long it took to write any Project - not built by you - and write it again and again and be faster everytime. What you will learn is to think in whole code parts and their pratical use and use them or Change them for your own Projects later on. Also you will increase the depth of your understanding by realising Connections and everything will start to feel much smaller. If you build your own Projects much later on this foundation it will be somuch easier and faster. And it's really fun too, to see how easy it gets to be able to write down whole programs at full Speed. That is not repetitive it just makes what you understood usable.

The code challenge projects are a good starting point.

Good luck!

Blaize Lange
Blaize Lange
2,298 Points

Thats a good point, I'll definitely try that, thanks.

I didn't say you should be mindlessly building code. I said hands on practice is the best way to learn.

I second konstantinminevich - the best way is to build and build and build .. bec through that, you will gain practice, also repetition is key, the more you practice, the easier it is to say. Take baby steps though.

Peni Kamakorewa
Peni Kamakorewa
3,483 Points

Build small bites, and test code to eliminate sneaky syntax errors.

It's funny, I can understand higher level issues like code impurity, and why you should avoid globals. In addition, I can bash the code out in a minute... But then it doesn't work, and... it's always buggy; a missed comma, a close parenthesis, etc. Then I get SOOO mad at myself. Practice. We need practice. That's what we are here for. Building and practicing. That is what will help us to get better.

And I think that both pieces of advice are correct. Building more will help us get better at what we already know. Refactoring in different ways, helps us spread our wings, and timed trials helps us become more skilled coders. Most JavasScript newbs say they get the basics, but can't figure out how to program anything, sure, they know a for loop, but they don't get how to make a quiz, or a battleship game, or a calculator, or minesweeper, or things like that. But as time goes on, with practice, we will get there! I am sure you can do it, I'm sure we all can if we just keep practicing and sticking with it!

Julian Laub
Julian Laub
1,982 Points

I think once you know how to fly the wings spread for themselves. Understanding set codes structures at full only sets the fundament to expand. And in fact makes it natural. Before that it's all a bit blurry.