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 trialKhaleel Yusuf
15,208 PointsWhat if I want to make another answer? It doesn't work.
Can I have the code to add another answer?
2 Answers
Khaleel Yusuf
15,208 Pointsapp.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
231,269 PointsThis 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.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsPlease show the code you have now, including the part you added that doesn't work, and then someone can help you fix it.