Almost there, we've almost completed this mini application, we've got the logic where we've got the
computer being selected, making a selection at random, we've got the player to be able to make a selection.
We've got our ability to check who won that particular round.
And now it's just a matter of putting that information to the player as well as updating the score.
So we need some more conditions.
We've got quite a few conditions going on in this game, and that's usually the likely scenario for
most games.
Where are you going to have a lot of conditions that are being met?
So we're going to check to see if the winner is a player, Arizona state player.
Plus equals and this is so we can output that value to the player, so we're going to do result plus
result and wins and I'll show you how we're going to use that information.
And we can also update the value of winner.
And we also need a way to keep score.
So I'm going to set up an array and both of them are going to start out with zero.
So this is how we're going to keep score.
So the first one will be the player, the second one will be the computer.
So winner zero.
And we're going to increment the value of winner zero next.
Check to see if result is equal to computer because remember, we are returning back either player computer
or draw as a result when we're checking the winner.
And if it is computer, then we're going to see computer wins.
So result wins the same format and then we're going to increment winner number two by one.
So this is going to give us the ability to output and update the score.
And we have score within the score object.
So taking that score in our HTML, we have player one and we can bracket out that score value there.
And then player two and also do the same thing.
Where are we going to bracket whatever the value of the score is?
It would close that off.
And then next, let's just add that in with JavaScript.
So we're going to add in winner the first item within that array and then add in the second item from
that array.
So saving that, let's try that out.
And now when we click it, we see the player wins.
So the player scored one, the player scored two.
It was a draw.
Player scored three, player scored four five.
And it's another draw and player scored again.
So lucky player around this time and this time the computer scored.
So it's always worth while taking the time just to make sure that your gameplay is working as expected.
And in this case it is.
So everything is working well.
You can also update this and make it look a whole lot better.
And the last thing that we want it to do is output a message to the user and we're going to create a
function in order to do that in the upcoming lesson.
So that's still to come.
Go ahead and add updating of the inner HTML.
So manipulating the element with score a class of score in it, which we've selected as a score object
in the earlier lessons and update that score.
So output the score values so that everyone can see what the score is.