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 trialCindy Lea
Courses Plus Student 6,497 PointsSolution for this code doesnt work either....anyone figure this one out?
Heres the link to my code. I even downloaded the solution into my workspace & nothing appeaars on my screen when program runs.
Its complaining about line 44.
Thank you for your help.
4 Answers
Steven Parker
231,269 PointsIt worked for me. Plus I didn't see any problems on line 44 (of either file).
Cindy Lea
Courses Plus Student 6,497 PointsMaybe its time to reboot & call it a night : ) Will try again. Thank you.
frank martinez
8,858 PointsIt works, no error. Still having issue?
Owa Aquino
19,277 PointsHere's my answer to the challenge.
Hope this help.
/*
To Do.
1. Create at least 3 questions for a quiz using two dimensional arrays.
2. Ask the question using prompt.
3. Return to the HTML page those question answered correctly and those questions answer wrong.
*/
/*
QUESTIONS
1. Founder of the Apple Inc. - Steve Jobs
2. Author of the book STEAL LIKE AN ARTIST. - Austin Kleon
3. A Front-End Web Designer. - Owa Aquino
*/
var html;
var correctCounter = 0;
var questionsToAnswer = [
['Founder of the Apple Inc.', 'Steve Jobs'],
['Author of the book STEAL LIKE AN ARTIST.', 'Austin Kleon'],
['A Front-End Web Designer.', 'Owa Aquino']
];
var correctQuestions = [];
var incorrectQuestions = [];
function print(message){
document.write(message);
}
function buildList(arr){
var listHTML = "<ol>";
for (var i=0; i < arr.length; i += 1){
listHTML += "<li>" + arr[i] + "</li>";
}
listHTML += "</ol>";
return listHTML;
}
for(var i = 0; i < questionsToAnswer.length; i+=1){
var question = questionsToAnswer[i][0]
var answer = questionsToAnswer[i][1]
var askquestions = prompt(question);
if(askquestions === answer){
correctCounter+=1;
correctQuestions.push(question);
} else {
incorrectQuestions.push(question);
}
}
html = "You have answer " + correctCounter + " question/s correctly";
html += "<h2> You have answer theses questions correctly:</h2>";
html += buildList(correctQuestions);
html += "<h2> You have answer theses questions wrong:</h2>";
html += buildList(incorrectQuestions);
print(html);
Josh Alling
17,172 PointsJosh Alling
17,172 PointsWhat is the error message that you are getting?