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


Daniel Lee
Daniel Lee
Courses Plus Student 566 Points

Everything works but the document wont print anything. Is there something wrong with my code?

1 Answer

Charles Wanjohi
Charles Wanjohi
9,235 Points

You have not declared the correctAnswers variable in your code. The code should give an error of undefined.Something else i have noted, from the answers you have provided, you expect your answers to be of string type.You thus should not use the parseInt method on the value returned by the prompt method i.e.

var question;
var answer;
var response;
var html;
var correctAnswers=0;
response = prompt(question);

Hope this helps you out.Regards