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 trialLinda Sakupwanya
6,318 PointsThe Conditional Quiz Challenge
my code is not showing anything when l save and refresh. Any idea(s) were l went wrong.
var correct = 0;
var answer1 = prompt("Which programming language has the name of a gem?");
if (answer1.toUpperCase() === "RUBY") {
correct += 1;
}
var answer2 = prompt("What is the best programming language?");
if (answer2 === "JavaScript") {
correct += 1;
}
var answer3 = prompt("Java is the same as JavaScript, true or false?");
if (answer3.toUpperCase() === "FALSE") {
correct += 1;
}
var answer4 = prompt("We use the........... dialogue to collect user input.");
if (answer4.toUpperCase() === "PROMPT") {
correct += 1;
}
var answer5 = prompt("In comparison operators, a number is less than a letter, true or false");
if (answer5.toUpperCase() === "TRUE") {
correct += 1;
}
//results
document.write("<p>You got " + correct + " out of 5 questions"</p>);
2 Answers
Zoltán Holik
3,401 PointsUncomment the last line :)
//results document.write("You got " + correct + " out of 5 questions");
document.write("You got " + correct + " out of 5 questions");
Your code is ok! It works. https://jsfiddle.net/f6qtojgg/
Linda Sakupwanya
6,318 PointsThanks a lot Zoltan, it works!!, Erik you're a star!
eck
43,038 Pointseck
43,038 PointsI reformatted you post to properly display your code! Be sure to checkout the Markdown Cheatsheet (found just above the post answer / comment button) to see how to do it yourself.
Also, you can take a look at how I edited your post to get a clearer idea. ♥!