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 Basics (Retired) Making Decisions with Conditional Statements The Conditional Challenge

Casey Catron
Casey Catron
1,831 Points

The Conditional Challenge Quiz - Check my code/feedback.

http://codepen.io/ccatron/details/OVrGQw/

Would you please check out my code. It's a little different than the teachers solution, but I'm working to get better and make my code clean. Please let me know what you think!

2 Answers

Christian Weatherford
Christian Weatherford
8,848 Points

Works great! Some things that might make life easier:

Instead of using the format of "variable += 1;" to increment a variable by one, you can use "variable++;" to achieve the same result. Both will work, but the latter saves you 1 to 3 keystrokes (depending on your use of spaces).

I believe this gets covered later in the course, but a good way to enhance the JavaScript logic is to use arrays and loops. The basic idea is to store your questions in one array, your answers in another, and using a loop to iterate through them one at a time. After these subjects are covered in the course you can always come back and implement the same solution with these additions if the course doesn't already have you do this.

Casey Catron
Casey Catron
1,831 Points

Thank you so much Christian! I'll make sure to keep working on it and when I learn more I'll make sure to update on my end.