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 Project Overview

Khaleel Yusuf
Khaleel Yusuf
15,208 Points

What if I want to make another answer? It doesn't work.

Can I have the code to add another answer?

Steven Parker
Steven Parker
229,744 Points

Please show the code you have now, including the part you added that doesn't work, and then someone can help you fix it.

2 Answers

Khaleel Yusuf
Khaleel Yusuf
15,208 Points

app.js

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

//Create Quiz var quiz = new Quiz(questions);

//Display Quiz QuizUI.displayNext();

Steven Parker
Steven Parker
229,744 Points

This code has a syntax error caused by mismatched brackets, but it's also not complete. In particular, the part that would determine how many possible answers there are to each question is not shown here.

There's probably a couple of places you would need to modify to change the number of answers, one place would be in the JavaScript code that uses the questions array, but the other is likely to be in the HTML code. I would also expect that all questions might need to have the same number of answers unless some more complicated changes are made.