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 1

Grant Eplin
Grant Eplin
2,407 Points

This is all I had in me...Thoughts?

So, just want some feedback really. I know I have not even used a loop but ...passing grade?

https://w.trhou.se/1dyf23xulb

2 Answers

Steven Parker
Steven Parker
229,644 Points

Not bad for a first draft, but you have a couple of issues:

  • question 1 input is converted to a number but then compared with a stored string
  • after asking question 2, the answer from question 1 is compared instead of 2

So you can currently get a point by answering "blue" to "How tall am I?" :wink:

And it might be easier to handle all answers as strings, so no conversion is needed and you have the opportunity to condense the code using a loop and/or a common "ask and answer" function.

Grant Eplin
Grant Eplin
2,407 Points

Great, thanks man. I actually posted this then went to sleep. I am going to start over today and try adding a loop as well, now I know where to look! Thanks for the detailed feedback, I appreciate it very much.