You are trying to use .toUpperCase like a variable, it's actually a function
Code:
// start quiz, none are correct var correct = 0;
// questions var answer1 = prompt("Name a programming language that's also named after a gem"); if (answer1.toUpperCase() === 'RUBY') { correct += 1; }
var answer2 = prompt("Name a programming language that's also a snake"); if (answer2.toUpperCase() === 'PYTHON') { correct += 1; }
var answer3 = prompt("Name the language that styles web pages"); if (answer3.toUpperCase() === 'CSS') { correct += 1; }
var answer4 = prompt("Name the programming language that adds function to a web page"); if (answer4.toUpperCase() === 'JAVASCRIPT' || answer4.toUpperCase() === 'JS') { correct += 1; }
var answer5 = prompt("What is the language that adds structure to a web page?"); if (answer5.toUpperCase() === 'HTML') { correct += 1; }
// output score if (correct === 5) { document.write("<p>You got " + correct + " out of 5 correct and earned the gold medal!</p>"); } else if (correct > 3) { document.write("<p>You got " + correct + " out of 5 correct and earned the silver medal!</p>"); } else if (correct > 1) { document.write("<p>You got " + correct + " out of 5 correct and earned the bronze medal!</p>"); } else { document.write("<p>You got " + correct + " out of 5 correct. You need to study more.</p>"); }