I'm currently developing a rock, paper, scissors game using HTML and JS.
Here is the link to the complete code (CSS, JS, HTML): http://jsfiddle.net/fJw4R/. You can also view the game with images here:
The functionality of the .math-module is working well, with the computer randomizing its choice when the player selects rock, paper, or scissors.
Now, I want to display a text string underneath the computer screen indicating whether the player wins or loses. I've started working on a function that looks like this:
function theWinnerIs(userChoice, computerChoice) {
// code to determine winner
}
How can I easily display the result from this function in the index file? For example, showing 'YOU WIN!' or 'YOU LOSE!'.
Any help on this would be greatly appreciated. Thank you.