The following example code demonstrates how to add basic scoring to your trivia game.
Add an HTML element with a unique id that will display the score. For example, you could place the following example to the top of the question screen.
Next you will need to update the score presented on the screen at the appropriate time. For starters, place the following line of Javascript inside the curly braces { }
of the onClickedAnswer()
function code block. Placing it at the top of the code block is a good place.
That's it, but you will likely want to customize how the score is presented. You could also add the core to the thank you screen in a similar way.