Question: 1. JAVASCRIPT EXERCISE 1. Create a simple Rock-Paper-Scissor game. 2. Make two HTML files and save them with the names index.html and rock.html 3. Add
1. JAVASCRIPT EXERCISE
1. Create a simple Rock-Paper-Scissor game.
2. Make two HTML files and save them with the names index.html and rock.html
3. Add a start button or link that navigates the user to rock.html
4. On the rock.html file, implement the game using JavaScript.
5. Ask the user to choose their move using a prompt() dialog box.
-
Get inputs for users turn. For e.g. R for Rock, P for Paper, S for Scissor.
-
Keep asking the user their move if the user enters some invalid input.
6. Then the computer chooses its move randomly and is displayed in an alert() dialog box.
7. The result is displayed on the screen using alert() dialog box.
8. The user should be asked using a confirm() dialog box if they want to play again, and a running score should be kept.
9. If the user selects not to continue, display the final score of the user and the computer, and the winner using alert() dialog box.
10. Add an Exit button or link on rock.html that navigates the user back to index.html.
SAMPLE:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
