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 trialBodie Wood
Full Stack JavaScript Techdegree Student 4,027 PointsShouldn't your last else if statement for ranking have the condition (count >= 1) not (count >= 2)?
This is my code and it works great:
let rank = ""; if(score === 5){ rank = "Gold"; }else if(score >= 3){ rank = "Silver"; }else if(score >= 1) { rank = "Bronze"; }else{ rank = "No crown"; }
I think your last else if statement needs to be (score >= 1), not (score >=2 )
1 Answer
Mark Sebeck
Treehouse Moderator 37,329 Pointshi Bodie. Nice catch you are correct. If you take a look at the teachers notes the correction is there
if ( correct === 5 ) {
rank = "Gold";
} else if ( correct >= 3 ) {
rank = "Silver";
} else if ( correct >= 1 ) { // check for 1-2 correct
rank = "Bronze";
} else {
rank = "None :(";
}