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 trialKrystian Kochanski
1,845 PointsNot sure what's wrong. I am getting zero point every time I answer all my questions. Can anyone tell me what;s wrong
<script type="application/javascript">
var correct = 0;
var answer1 = prompt("What is a language like to GEM");
if (answer1.toUpperCase === "RUBY") {
correct +=1;
}
var answer2 = prompt("What language styles a web page");
if (answer2.toUpperCase === "CSS") {
correct +=1;
}
var answer3 = prompt("What Language add interactivity to a web page");
if (answer3.toUpperCase === "JAVASCRIPT") {
correct +=1;
}
var answer4 = prompt("What is the most recent flavor of HTML");
if (answer4.toUpperCase === "HTML5") {
correct +=1;
}
//ouput results document.write("<p>You got " + correct + " Out of 4 questions correct.<p>");
// output rank if (correct === 4) { document.write("You earned gold crown"); } else if (correct >= 3) { document.write("You earned silver crown"); }else if (correct >= 1) { document.write("You earned one point only. Prepare next time"); }
</script>
3 Answers
Steven Parker
231,275 PointsWhen invoking a method, you must put parentheses after the method name.
For example:
if (answer1.toUpperCase() === "RUBY") {
Krystian Kochanski
1,845 Pointsgreatly appreciated, thank !
Joshua Bahr
1,746 Pointsyeah, there's actually a mistake in his example. He only places the parenthesis after the first .toUpperCase () example.