Building a trivia game, but I can't figure out why the rest of the else if won't fire, only the if statement works. But if I take the condition from the else if and put it in If statements condition, this causes it not to fire.
if (questionNumber === 4) {
if (rightCounter >= 3) {
$(".mainDisplay").html("Congratulations! You've won!");
$(".rightDisplay").html("Correct Answers: " + rightCounter);
$(".wrongDisplay").html("Incorrect Answers: " + wrongCounter);
} else if (wrongCounter >= 3) {
$(".mainDisplay").html("Sorry, you've lost!");
$(".rightDisplay").html("Correct Answers: " + rightCounter);
$(".wrongDisplay").html("Incorrect Answers: " + wrongCounter);
console.log("Test");
} else {
$(".mainDisplay").html("Tied! Try again!");
$(".rightDisplay").html("Correct Answers: " + rightCounter);
$(".wrongDisplay").html("Incorrect Answers: " + wrongCounter);
};
}
Aucun commentaire:
Enregistrer un commentaire