Display the Total Question Count at Welcome
In this simple mod we will let the player know at the welcome screen how many questions are in the database using the trivia.totalQuestions
value that automatically counts the questions for us.
1 - Modify your welcome screen HTML like on line 4 below, where the id="question-count"
was added.
HTML
Now we will insert the trivia.totalQuestions
value into a sentence to be placed in the element with id="question-count"
.
2- Add the code on line 4 below to the end of your displayWelcome()
function in your JavaScript.
JavaScript
That's it. Try it out.
Last updated