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.

Ernest Son
13,532 Pointscounter always reports "all were right" when not so....
//use 2-d array to hold question-answer
var questions = [
["What is the capital of Georgia, USA?", "Atlanta"],
["How do you spell fart backwards?", "tarf"],
["What is the programming language that is abbreviated with js?", "JavaScript"],
["Who is the current president of the United States?","Barack Obama"],
["Who is the actor who played Batman in the original Batman TV series","Adam West"],
];
var correctAnswers = 0;
var question;
var response;
var answer;
var html;
//add functions here
function print(message) {
document.write(message);
}
//create a loop, ask 5 questions and compare to answer
//console.log(q_and_a[0][0]);
for ( var i=0; i < questions.length ; i++ ) {
question = questions[i][0];
answer = (questions[i][1]).toLowerCase;
//use the prompt method to ask question i
response = (prompt(question)).toLowerCase;
//compare to the right answer with an if statement
if (response === answer) {
//add to correctAnswers
correctAnswers += 1;
}
}
html = "You got " + correctAnswers + " question(s) right!";
print(html);
the message always says there were 5 correct answers.....
Ernest Son
13,532 PointsErnest Son
13,532 PointsI did fix the fart answer...;-)