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 (Retired) Making Decisions with Conditional Statements The Conditional Challenge Solution

toUpperCase not working

My code works fine until I add in the toUpperCase method. Can you let me know why?

var q1 = prompt("What is Elvis's last name?"); var q2 = prompt("Who was god of the Trojans?"); var q3 = prompt("Who sung feel the steel?"); var q4 = prompt("What is 5 minus 3?"); //q4 = parseInt(q4); var q5 = prompt("To be or not to be, that is the _?");

var answerTotal = 0;

if (q1.toUpperCase === "PRESLEY") { answerTotal += 1; } if (q2.toUpperCase === "APOLLO") { answerTotal += 1; } if (q3.toUpperCase === "STEEL PANTHER") { answerTotal += 1; } if (parseInt(q4) === 2) { answerTotal += 1; } if (q5.toUpperCase === "QUESTION") { answerTotal += 1; }

if (answerTotal === 5) { document.write("Congratulations you have recieved the gold crown!"); } else if (answerTotal >= 3) { document.write("Congratulations you have recieved the silver crown!"); } else if (answerTotal >= 1) { document.write("Congratulations you have recieved the bronze crown!"); } else { document.write("Sorry you missed all the answers!"); }

2 Answers

you forgot to call the function man

string.toUpperCase()

you did:

string.toUpperCase
Joshua Asher
Joshua Asher
3,775 Points

Thanks Abdul for the answer. I was having the same issue too. ;)