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.

Joseff Kitchen
Front End Web Development Techdegree Graduate 16,751 PointsUncaught SyntaxError: Unexpected end of input quiz.js: 22
I seem to be getting an error message in the console can someone please advise as I think my code is correct.
https://teamtreehouse.com/workspaces/41486415
Thanks
2 Answers

Joseff Kitchen
Front End Web Development Techdegree Graduate 16,751 PointsHi Steven,
function print(message) {
document.write(message);
}
let correct;
let questions = [
['what is my wife name?', 'Mary'],
['what is my mums name?', 'Jane'],
['what is my dads name?', 'John'],
['what is my brothers name?', 'Chris']
];
for (let i=0; i< questions.length; i+=1) {
let userAnswer = prompt (questions [i][0])
if(userAnswer === questions [i][1]) {
correct ++;
};
print (`You answered ${correct} out of ${questions.length} right.`);

Rich Donnellan
25,780 PointsQuestion updated with code formatting. Check out the Markdown Cheatsheet below the Add an Answer submission for syntax examples, or choose Edit Question from the three dots next to Add Comment to see how I improved the readability.

Steven Parker
220,450 PointsThe snapshot is a much better way to make your issue easy to replicate. If you must post code, use use Markdown formatting to preserve the appearance,
But it looks like you forgot to give "correct" an initial value (0), and the "for" loop seems to be missing a closing brace.
Steven Parker
220,450 PointsSteven Parker
220,450 PointsYou can't share a direct URL to your workspace, it's temporary and only exists while you are using it.
But you can use the snapshot function in the workspace and provide the link to that.