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 trialBrian Diggs
4,794 Pointsnot able to go on to the next question if i answer right where did i go wrong
alert("Do You Know ME");
var questionRight = 0;
var questionsWrong = 0;
var questions = 2;
var questionsLeft = ' [' + questions + ' questionsLeft]';
var question1 = prompt("whats my favorite color" + questionsLeft);
questions -= 1;
if (question1 === "royal blue") {
alert('Do You Know ME');
questionsRight += 1;
} else {
questionsWrong += 1;
alert("You Are Wrong!!!");
}
questionsLeft = ' [' + questions + ' questionsLeft]';
var question2 = prompt("whats my football team" + questionsLeft);
questions -= 1;
if (question2 === "broncos")
{
questionsRight += 1;
alert("You Are Right!!!");
}
else {
questionsWrong += 1;
alert("You Are Wrong!!!");
}
2 Answers
Steven Parker
231,269 PointsOn line 2, you initialize a variable named "questionRight" (singular), but later in the code you refer to "questionsRight" (plural). You can use either name, but it must be consistent throughout the program.
Also, when posting code, always use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. Or watch this video on code formatting.
Brian Diggs
4,794 Pointsthank you