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 Making Decisions in Your Code with Conditional Statements The Conditional Challenge

Teacher'sNotes

Where are the Teacher's notes? I am trying to find the code that Guil said he posted.

1 Answer

Steven Parker
Steven Parker
229,644 Points

Are you sure that was in this video? I don't see a reference to "Teacher's Notes" in the one linked to the "Watch Video" button.

There are some notes on the next video's page. Is that what you are looking for?

Ok. Steven, can you see what is wrong with this? It fails on the first variable.


let correctGuess = 0;

// 2. Store the rank of a player let playerRank = ("No crown");

// 3. Select the <main> HTML element document.querySelector = "main";

/*

  1. Ask at least 5 questions
    • Store each answer in a variable
    • Keep track of the number of correct answers */
      const qOne = prompt("Largest city in FL"); if (qOne.toUppercase() === "MIAMI"){ correctGuess += 1; }

const qTwo = prompt("Place where Disneyworld is"); if (qTwo.toUppercase() === "ORLANDO"){ correctGuess += 1; }

const qThree = prompt("Place where Busch Gardens is"); if (qThree.toUppercase() === "TAMPA"){ correctGuess += 1; }

const qFour = prompt("County with Manatee River"); if (qFour.toUppercase() === "MANATEE"){ correctGuess += 1; }

const qFive = prompt("Place where Univ of FL is"); if (qFive.toUppercase() === "GAINESVILLE"){ correctGuess += 1; }

/*

  1. Rank player based on number of correct answers
    • 5 correct = Gold
    • 3-4 correct = Silver
    • 1-2 correct = Bronze
    • 0 correct = No crown */

if (correctGuess === 5){ playerRank = "Gold" } else if (correctGuess >=3){ playerRank = "Silver";
} else if (correctGuess <=2){
playerRank= "Bronze";
} else {
playerRank = "No Crown"; }

// 6. Output results to the <main> element

main.innerHTML = <h2> You got {correctGuess} right. Your rank is {playerRank}</h2>

Steven Parker
Steven Parker
229,644 Points

Sure, and I also answered your other question about it.

You have "toUppercase" (with lower-case "c") instead of "toUpperCase" (with capital "C") in several places.

Also, it looks like your template literal tokens are missing the "$" symbol.

And when posting code to the forum, use Markdown formatting to preserve the appearance, or share the entire workspace by making a snapshot and posting the link to it.

If your original question has been answered, you can mark the question solved by choosing a "best answer".
And happy coding!