Redo, New Game and score tallying features #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have made a new game and redo feature with the use of buttons. Also, I have made a tally of the user's attempts while playing a round of the game, and their score which tracks how many matches they made within a game. Lastly, I have made a message that pops up when the user completed all the matches.
All the features I added are in the div with the class of extra on the HTML page of video-11.
The New Game and Redo buttons work by calling the newGame or redo functions respectively. In scripts.js for video-11 the newGame function shuffles the cards and then calls the redo function which resets all variables and turns over the cards using a for loop.
In the function score, the scoreNum variable increases each time the function is called and outputs the score along with a message. Also, if the score becomes equivalent to 6 (the number of matches possible) the function outputs a congratulatory message.
In the attempts function, each time it is called the attemptsNum variable increases and the new value gets outputted along with a message.