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 trialTodd Breeze
926 PointsI have looked at everyone elses code and i don't have the same errors but i get 4 out 5 right every time
heres my code
var correct = 0; var total = correct;
var answer1 = prompt('Is Candice older than Ivy?'); if(answer1.toUpperCase() === 'TRUE' || 'YES'){ correct += 1; } var answer2 = prompt('Is Keith Breeze a plumber or a builder??'); if(answer2.toUpperCase() === 'PLUMBER'){ correct += 1; } var answer3 = prompt('Is Ivy 6 years old?'); if(answer3.toUpperCase() === 'FALSE' || 'NO'){ correct += 1; } var answer4 = prompt('Can Ebony fart loud?'); if(answer4.toUpperCase() === 'TRUE' || 'YES'){ correct += 1; } var answer5 = prompt('Does Todd love Candice?'); if(answer5.toUpperCase() === 'TRUE' || 'YES'){ correct += 1; }
//document.write(correct); if(total === 5){ alert('Congratulations you got a gold medal!'); }else if(total === 2 || 3){ alert('Congratulations you got a silver medal!'); }else if(total === 1 || 2){ alert('Congratulations you got a bronze medal!'); }else{ alert('Better luck next time!'); }
2 Answers
james south
Front End Web Development Techdegree Graduate 33,271 Pointsi think your conditional syntax is incorrect. instead of
if a == b || c || d
for example, try
if a==b || a==c || a==d
etc.
Todd Breeze
926 PointsYes that's it thank you so much and for the prompt reply =)