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 Build an Interactive Form

Michael Escribano
seal-mask
.a{fill-rule:evenodd;}techdegree
Michael Escribano
Full Stack JavaScript Techdegree Student 5,221 Points

Full Stack JavaScript Techdegree Project help

So, I need to display certain options in the drop down menu for the shirt colors based off which style you choose.. I'm not even sure where to start.. I was thinking a loop inside an if/else statement but I'm not even sure if it's possible and I'm getting frustrated and discouraged because I feel like I should know how to do this.. Can anyone take a look at my code snapshot and let me know what I may be doing wrong or point me in the general direction so I can kind of figure this out on my own. https://w.trhou.se/6yl3mg4rga

I'm not even sure if what I have so far is good..

GREGORY ASSASIE
GREGORY ASSASIE
3,898 Points

what you have so far is Good but i encourage the use of function to cut down repetition. I will take a look at your project once i have a bit more time to spare

Keep up the good work

Michael Escribano
seal-mask
.a{fill-rule:evenodd;}techdegree
Michael Escribano
Full Stack JavaScript Techdegree Student 5,221 Points

Thanks GREGORY ASSASIE . Could you also explain a bit further what you mean about function? I know it will help me refactor my code but just want to make sure I don't end up breaking it to the point of not understanding how to make it work again lol. Thanks again.

3 Answers

GREGORY ASSASIE
GREGORY ASSASIE
3,898 Points

Sure. I'm positive functions will be introduced later in the course

But here's a bit of a run down about functions Generally speaking, a function is a "subprogram" that can be called by code external (or internal in the case of recursion) to the function. Like the program itself, a function is composed of a sequence of statements called the function body. Values can be passed to a function, and the function will return a value.

In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.

Continue reading here mdn functions

GREGORY ASSASIE
GREGORY ASSASIE
3,898 Points

Don't worry Michael Esribano. Functions will definitely be introduced properly in the course I'm sure

GREGORY ASSASIE
GREGORY ASSASIE
3,898 Points

Alright I will for your project and rewrite that for you just so you see how I would go about it