Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 90,932 Points

My go at the first Array challenge in JS Loops and Objects

I have followed a few good programming conventions such as declaring variables at the top of the screen, created the two dimensional array correctly and the for loop. I know how to iterate through an array, and a multidimensional array.

I followed the video solution in the end but this was my attempt

var numCorrectAnswers = 0;
var listCorrect
var listIncorrect;

var askOne;
var askTwo;
var askThree;

var quiz = [
  ["Who Wrote Harry Potter", "J.K. Rowling"],
  ["How many countries make up the United Kingdom?", "Four"],
  ["Who Wrote James Bond?", "Ian Fleming"]


for(var i=0; i<quiz.length; i+=)

function print(message) {

So I'm probably about half way there. This was me following everything I knew from the top of my head to do the challenge. When comparing it to the solution I can see that I declared my variables preparing them for the wrong reasons. I didn't even use the variables I made for the individual questions so I just lost heart and went to the video solution.

But I didn't really get how to use the variables to compare the input to the answers. It seems so simple when looking at the solution but I just didn't get it.

I also noticed in the solution that the quiz was only for number answers and my answers are strings, even the "number" answer.

What do you think about where I go from here? Try again or just study the solution more? Thanks. :)

1 Answer

Hey Jonathan,

I would definitely say keep on trying, man. When you finally figure out something for yourself, it is incredibly satisfying. But if you have any specific questions, there are a bunch of us who are willing to help!