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 trial
Nigel Rodgers
15,777 PointsThere is a bug in the provided challenge solution
In the JavaScript Basics Conditional Challenge there is a bug in the code provided to download. The original code is like this:
// output rank
if ( correct === 5 ) {
document.write("<p><strong>You earned a gold crown!</strong></p>");
} else if (correct > 3) {
document.write("<p><strong>You earned a silver crown.</strong></p>");
} else if (correct > 2) {
document.write("<p><strong>You earned a bronze crown.</strong></p>");
} else {
document.write("<p><strong>No crown for you. You need to study.</strong></p>");
}
I think it should be like this:
if ( correct === 5 ) {
document.write("<p><strong>You earned a gold crown!</strong></p>");
} else if (correct > 2) {
document.write("<p><strong>You earned a silver crown.</strong></p>");
} else if (correct > 0) {
document.write("<p><strong>You earned a bronze crown.</strong></p>");
} else {
document.write("<p><strong>No crown for you. You need to study.</strong></p>");
}
1 Answer
Steven Parker
243,318 PointsGood catch!
The correct answer (functionally equivalent to yours) is shown in the video:
if ( correct === 5 ) {
document.write("<p><strong>You earned a gold crown!</strong></p>");
} else if (correct >= 3) {
document.write("<p><strong>You earned a silver crown.</strong></p>");
} else if (correct >= 1) {
document.write("<p><strong>You earned a bronze crown.</strong></p>");
} else {
document.write("<p><strong>No crown for you. You need to study.</strong></p>");
}
But as you noticed, the download is different.
Postings here, particlularly those without links or tags (like this one), might not be seen by the staff. I recommend you follow the bug report procedure on the Support page.