8. Finishing the Game

Once all questions are answered the trivia library will call your displayThankyou( ) function. Notice how the game results are also displayed in this function. Your thank you screen HTML provides a restart button that will allow the player to play again. Update your displayThankyou( ) function to match the one below.

JavaScript
function displayThankyou() {
  $(".screen").hide();
  $("#thankyou-screen").show();
  $("#game-results").html(`You got ${trivia.totalCorrect} of ${trivia.totalAnswered} correct.`);
}

Your core trivia game code should work from start to finish now.

Last updated