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

JavaScript JavaScript Basics (Retired) Making Decisions with Conditional Statements The Conditional Challenge Solution

Sufiyaan Haroon
seal-mask
.a{fill-rule:evenodd;}techdegree
Sufiyaan Haroon
Full Stack JavaScript Techdegree Student 9,558 Points

Nothing shows up

I did all this code but no questions show up.

//The quiz begins, no correct answers
var correct = 0;

// Questions begin
var answer1 = prompt("What is a programming language that's is also a gem?");
if (answer1.toUpperCase() === "RUBY") {
  correct += 1;
}

var answer2 = prompt("Name a programming language that's also a snake?");
if (answer2.toUpperCase === "PYTHON"){
  correct += 1;
}

var answer3 = prompt("What programming language do you use to style a web page?");
if (answer3.toUpperCase. === "CSS"){
  correct += 1;
}

var answer4 = prompt("What programming language do you use to make the structure of a web page?");
if (answer4.toUpperCase === "HTML") {
  correct += 1;
}

var answer5 = prompt("What programming do you use to add interactivity to a web page?");
if (answer5.toUpperCase === "JAVASCRIPT") {
  correct += 1;
}

//Results
document.write("<p>You got " + correct + "out of 5 correct.</p>");

//Rank
if (correct === 5) {
  document.write("<p><strong>You earned a gold crown!</strong></p>");
}
else if (correct >= 3) {
  document.write("<p><strong>You won a silver crown.</strong></p>");
}
else if (correct >= 1) {
  document.write("<p><strong>You won a bronze crown.</strong></p>");
}
else if {
  document.write("<strong><p>You won nothing. You need to study more");
}```
Kevin Lawler
seal-mask
.a{fill-rule:evenodd;}techdegree
Kevin Lawler
Full Stack JavaScript Techdegree Student 5,929 Points

Hi Sufiyaan!

you should go to the website jshint.com, and paste in your code.

It will alert you to all the things to fix!

I like to delete the jshint default code before pasting mine

3 Answers

Kevin Lawler
seal-mask
.a{fill-rule:evenodd;}techdegree
Kevin Lawler
Full Stack JavaScript Techdegree Student 5,929 Points

Coding is very particular when it comes to "syntax." It's like a "typo" in a letter or email!

In the "RUBY" section you had the (), but it's missing in the others! Using a code checker like jshint will make finding your errors a little easier.

Sorry I didn't reply earlier in the Answer box!!

Kevin Lawler 31 minutes ago Hi Sufiyaan!

you should go to the website jshint.com, and paste in your code.

It will alert you to all the things to fix!

I like to delete the jshint default code before pasting mine

Shawn Rieger
Shawn Rieger
9,916 Points

Start by changing toUpperCase to toUpperCase() as it is a method and will not execute without ().

Kevin Lawler
seal-mask
.a{fill-rule:evenodd;}techdegree
Kevin Lawler
Full Stack JavaScript Techdegree Student 5,929 Points

Your welcome Sufiyaan! It's always a good place to start if you are lost. Sometimes the littlest thing can shut your code down. That is why you should always check and recheck all along the process, and try your best NOT to wait to review everything until you're done! It's alot easier to see a misplaced bracket in a small section, than in the middle of dozens of lines of code!

In the jshint CONFIGURE, at the top middle of the page, I also have the jQuery, and New JavaScript features (ES6) settings checked along with the default choices.