Question
JAVASCRIPT Simple Rock/Paper/Scissors. Use the prompt box to ask the user, Pick 0 for Rock, 1 for Paper, or 2 for Scissors (youll have to
JAVASCRIPT
Simple Rock/Paper/Scissors. Use the prompt box to ask the user, Pick 0 for Rock, 1 for Paper, or 2 for Scissors (youll have to use ParseInt on this one). Then generate a random number between 0 and 3 (remember, when we generate a random number it goes up to but not including 3). Okay, heres the part I always get confused. Rock (0) beats Scissors (2), paper(1) beats rock (0), and scissors(2) beats paper(1). So you must write out who won by checking your answer against the computers randomly generated answer, e.g., (&& means and) if ((myanswer == 0) && (randnum == 1) ) { document.write(
Sorry, the computer won.
) }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started