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 Object-Oriented JavaScript (2015) Practice Project User Interface Code

My questions are not coming up in my browser. I am using chrome

i'm doing your Object-Oriented JavaScript final quiz project. here is a snapshot of my code https://w.trhou.se/6o7bcl5v7q

1 Answer

Justin Iezzi
Justin Iezzi
18,199 Points

You'll need to check out your console in your developer tools to see what errors you're getting in Javascript, it's invaluable when figuring out why things aren't working.

In quiz_ui.js, you're missing two last curly braces at the very end, one for displayProgress: function() and another for var QuizUI.

See here -

displayProgress: function() {
    var currentQuestionNumber = quiz.currentQuestionIndex + 1;
    this.populateIdWithHTML("progress", "Question " + currentQuestionNumber + " of " +
quiz.question.length);
  }
}

In app.js you broke into a newline in your questions array, so it thinks the rest of that object is a string.

See here -

var questions = [
  new Question("Who was the first President of the United States?", [ "George Washington", "Thomas Jefferson" ], "George Washington"),
      new Question("What is the answer to the Ultimate Question of Life, the Universe, and Everything?", ["Pi","42"], "42")
];

I think that was it, it should run if you fix those two things. I was only able to find those errors by reading the console and checking the lines it gave, so be sure to check it out in the future. :)