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 trialAmy Garlesky
2,022 PointsOnly my questions are popping up, not the results.
Hi! Here is my code. Only my questions are popping up, not the results. I put my code into JSHint too and it can't find any errors. I'm a bit confused..
console.log("Begin Program"); var totalLog = 0;
// Conditional strings calculating point totals
var q1 = prompt("What planet do we live on?"); if(q1.toUpperCase () === "EARTH"){ totalLog =+ 1; }
var q2 = prompt("What is 2+2?"); if(q2 === "4"){ totalLog += 1; }
var q3 = prompt("What is Ohio's state bird?"); if(q3.toUpperCase () === "CARDINAL"){ totalLog += 1; }
var q4 = prompt("Sweden is the world's largest consumer of what?"); if(q4.toUpperCase () === "CANDY"){ totalLog += 1; }
var q5 = prompt("What color does yellow and blue make when mixed?"); if(q5.toUpperCase () === "GREEN"){ totalLog += 1; }
//calculating crown totals
alert("You got " + totalLog + " correct."); if (totalLog === 5){ alert("You've earned a gold crown!"); }else if(totalLog >= 3){ alert(" You've earned a silver crown!"); }else if (totalLog >= 1){ alert("You've earned a bronze crown!"); }else { alert("You've earned no crown"); }
console.log("End Program");
2 Answers
Steven Parker
231,275 PointsIt worked for me in Chrome.
Without peeking at the answers, I got 3 points and a silver crown.
And when posting code, remember to use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. Or watch this video on code formatting.
Amy Garlesky
2,022 PointsGreat, thanks to you both! It must've just been my computer :/
Kate Ross
Full Stack JavaScript Techdegree Student 19,434 PointsKate Ross
Full Stack JavaScript Techdegree Student 19,434 PointsHi Amy, I've run your code here and it seems to be working fine. Try running it in the browser developer tools.