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 JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Build a Quiz Challenge, Part 1

My unique code, feel free to give some feedback! ^^

Please keep in mind that i'm dutch and english is not my motherlanguage. Btw the questions are dutch.

console.log(Program starded...);

//array with questions and answers.
var questions = [
    ["Waar ligt manneke pis?", "brussel"],
    ["Hoe noemt men vervoer zoals: de bus, de trein, de tram?", "openbaar vervoer"],
    ["In welke sport gooit men een 'ijzeren bal' zo ver als hij kan?", "kogelstoten"]

//variabels for the math and output.
var answer = 0;
var correct_answer = 0;
var HTMLwrong = "<h1>Je hebt deze vragen helaas fout:</h1>";
var HTMLcorrect = "<h1>Je hebt deze vragen juist:</h1>";

//function to print any message i want to, to the screen.
function print(message) {

//function where the question gets asked and stored in'answer'.
function ask_question() {
answer = prompt(questions[i][0]);

/* questions get asked and answer is checked if right or wrong.
If it's right it gets added to 'HTMLcorrect'.
If it's wrong it gets added to 'HTMLwrong'.
for (var i = 0; i < questions.length; i += 1 ) {
    if (answer.toLowerCase() === questions[i][1]) {
      correct_answer += 1;
      HTMLcorrect += "<li>" + questions[i][0] + "</li>";
    } else {
      HTMLwrong += "<li>" + questions[i][0] + "</li>";

//everything gets printed to the screen.
print("Je hebt maar liefst " + correct_answer + " juiste antwoorden!" + HTMLcorrect + HTMLwrong);

console.log(Program ended.);

Mark Miller
Mark Miller
45,831 Points

The contents of the parenthesis in the for(ERROR IS HERE) loop are not correct. There is no closing ). Also there should be three entries, but I see only two.

lol! where is the peeing staue..:D say hows things in your country?