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 trialIsmael Ramirez
3,627 PointsWhat's wrong with my code?
var correct = 0;
var answer1 = prompt("Name a programming language that's also a gem?");
if (answer1.toUpperCase() === 'RUBY') {
correct += 1;
}
var answer2 = prompt("What language builds the structure of the page?");
if (answer2.toUpperCase() === 'HTML') {
correct += 1;
}
var answer3 = prompt("What programming language is also a snake?");
if (answer3.toUpperCase() === 'PHYTON') {
correct += 1;
}
var answer4 = prompt("what language is used to style pages?");
if (answer4.toUpperCase() === 'CSS') {
correct += 1;
}
var answer5 = prompt("What language is used to add interactivity to the page?");
if (answer5.toUpperCase() === 'JAVASCRIPT') {
correct += 1;
}
if ( correct === 5) {
document.write("<p><strong> You earned a gold medal. </strong></p>");
} else if ( correct >= 3 ) {
document.write("<p><strong> You earned a silver medal. </strong></p>");
} else if ( correct >= 2 ) {
document.write("<p><strong> You earned a bronze medal. </strong></p>");
} else {
document.write("<p><strong> NO MEDAL FOR U [REDACTED]. </stong></p>");
}
Steven Parker
231,275 PointsEven if the staff does not remove or redact your post, you're probably more likely to get help if your post does not contain anything that might be interpreted as offensive.
Chris Freeman
Treehouse Moderator 68,457 PointsThis post has been flagged as being offensive and violates the Code of Conduct. Please refrain from posting content such as this.
2 Answers
Steven Parker
231,275 PointsNow that your code has been formatted (and redacted), there doesn't seem to be anything wrong with the code itself.
But one of the answers has a spelling error, it has "PHYTON' instead of "PYTHON". Was that your issue?
Ismael Ramirez
3,627 PointsSorry if you all got offended I was with my black friend and he told me to write that. Since we were just messing around and laughing. I wrote the code in VSC and just copied and pasted the same code here. I am really sorry everybody.
Steven Parker
231,275 PointsHumor is easily misunderstood in public postings, I've gotten into trouble with that myself even without ever using any offensive terminology.
But did your issue get resolved? You can mark a question solved by choosing a "best answer".
And happy coding!
Armin Kadic
16,242 PointsArmin Kadic
16,242 PointsJust a friendly advice, better remove the message with the N word at the end of your code. I don't think the staff on here will like it (or anyone for that matter).