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

3 Answers

Steven Parker
Steven Parker
231,236 Points

There's still a few more issues to be addressed:

  • the loop only asks the questions, the scoring code is outside the loop
  • since the answers are all numbers, the "guess" must be converted to match
  • the index for the answer should be "[i][1]", not "[0][i]"
  • questionsCorrect should be assigned with the concatenating operator ("+=")
  • both "questionsCorrect" and "wrong" should be initialzed to an empty string
Steven Parker
Steven Parker
231,236 Points

At first glance, I notice two things in "quiz.js:

  • on line 23 you call "propt", but you don't store the value it returns anywhere
  • on line 24 you attempt to convert the questions array into a number

I'd guess that a new variable (first to store, then convert from) should be involved in both lines.

angelod
angelod
6,694 Points

fix some errors, but don't understand what you mean by storing the value so it returns anywhere. not quite sure on how to do that. well just confuse

Steven Parker
Steven Parker
231,236 Points

You might use an assignment to save the result of using "propt", as in this generic example:

var someVariable = prompt("a prompt question");

Calling "prompt" without the assignment asks the question, but whatever answer the user types is lost.