I'm building a trivia game, and it has a game finished screen that displays how well you did. It says "You got __ out of __ right" (ex: 6 out of 8 right) and the code looks like this:
function displayThankyou() {
$(".screen").hide();
$("#thankyou-screen").show();
$("#game-results").html(
`You got ${trivia.totalCorrect} of ${trivia.totalAnswered} correct.`
);
}
If I wanted to show a different message if the person did well on the game, like 6 right or better: "You did great!" or if they didn't do well, 5 right or less: "Better luck next time.", do I use an if else to do this?
Aucun commentaire:
Enregistrer un commentaire