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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!