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 trialRwanda Muhammad
Full Stack JavaScript Techdegree Student 4,116 PointsFirst part of code works, but no matter the answers, it states 5 out of 5 correct
1 Answer
K Cleveland
21,839 PointsCheck out this part of your code:
var answer2 = prompt("The average person does what thirteen times a day?");
if (answer2.toUpperCase === 'LAUGHS'); {
correct += 1;
}
Remember, when you use
;
this basically ends the statement. So in reality, it seems to me your code is being read like this:
//set answer2 to whatever the user inputs
var answer2 = prompt("The average person does what thirteen times a day?");
//statement that stops after 'LAUGHS')
if (answer2.toUpperCase === 'LAUGHS');
//add +1 to correct
{correct += 1;}
Is this what you want? Definitely not. But I think now you can figure it out. Good luck! :)