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 trialrick guzman
2,108 Pointshow the var correct added the question or knew how to add the answers?
don't know how the var correct added the questions...
rick guzman
2,108 PointsHere it is the code that i've created and when I put a wrong answer still read 2 correct answer...don't know where I'm failing...
// quiz begins, no answer correct var correct = 0;
// ask questions var answer1 = prompt('Name the best team in the NBA'); if (answer1.toUpperCase() === 'HAWKS'); { correct += 1; } var answer2 = prompt('Name the best MLB team'); if (answer2.toUpperCase() === 'DODGERS' || answer2.toUpperCase() === 'LA'); { correct += 1; }
if (correct === 2){ document.write('you are great'); } else if (correct === 1){ document.write('you are good') } else { document.write('watch espn'); }
Joel Bardsley
31,249 PointsRick, you shouldn't put a semicolon at the end of your if statements (before the opening curly brace), it should just be:
if (conditional) {
// code to be executed
}
rick guzman
2,108 PointsHey Joel...you are awesome!.... that was it....Thanks Steven for taking the time....way to go baby!!!!
Steven Parker
231,269 PointsSteven Parker
231,269 PointsI don't quite understand what you are asking. Can you elaborate a bit more?