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 trialJaeVeine Covington
9,208 PointsDon't know why its not fully running(JavaScript Basics)
Here is my code for the in-video practice. here is a link to the video solution teamtreehouse.com/library/the-conditional-challenge-solution-2 The code partially works but the questions 3 and 4 aren't working and i dont know why.
let correctCount = 0;
let question1 = prompt("How many stars were on the original US flag?"); let question2 = prompt("How many senators are in congress?"); let question3 = prompt("What US currency is Abraham Lincoln on? answer starting with 'The' such as 'The dime'."); let question4 = prompt("Who is was the first president of the United states?"); let question5 = prompt("How many stars are on the CURRENT US flag?");
if (+question1 === 13 || question1.toUpperCase === "THIRTEEN") { correctCount += 1; }
if(+question2 === 100 || question2.toUpperCase === "ONE HUNDRED" || question2.toUpperCase === "1 HUNDRED") { correctCount += 1; }
if (question3.toUpperCase === "THE PENNY" || question3.toUpperCase === "THE FIVE DOLLAR BILL" || question3.toUpperCase === "THE 5 DOLLAR BILL" ){ correctCount += 1; }
if (question4.toUpperCase === "GEORGE WASHINGTON") { correctCount += 1; }
if (+question5 === 50 || question5.toUpperCase === "FIFTY") { correctCount += 1; }
let playerRank = " ";
if (correctCount === 0) { playerRank = "0 correct = No crown"; }
else if (correctCount === 1 || correctCount === 2) { playerRank = "1-2 correct = Bronze";}
else if (correctCount === 3 || correctCount === 4) { playerRank = "3-4 correct = Silver";}
if (correctCount === 5) { playerRank = "5 correct = Gold";}
document.querySelector('main').innerHTML = <h1>You Got ${correctCount} Out Of 5 Correct</h1>
<p>${playerRank}</p>
;
3 Answers
Steven Parker
231,236 PointsWhen you call a method (like "toUpperCase"), you must put parentheses after the method name even if it does not require any arguments.
JaeVeine Covington
9,208 PointsWow I'm so mad at myself for missing that lol. I just face-palmed myself lol thank you for the insight.
Mauricio Ariza
1,731 PointsYour answer helped me a lot. I had a similar problem.