Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
210,442 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
210,442 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!