Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using JavaScript to create a rock, paper, scissors game in a file titled computer-plays.html you will make the computer select a hand sign and log

Using JavaScript to create a rock, paper, scissors game in a file titled computer-plays.html you will make the computer select a hand sign and log the results on the console. After you click a button, the program generates a random number from 0 to 2, representing the hand sign the computer has selected. The program logs the human and computer choices on the console and who wins. Extend the function play to call the function randomSelection( ); this function returns a string representing the hand sign name (i.e., paper, rock, or scissors.) After selecting the computers hand sign, play must call the function whoWins(human, computer); this function takes as arguments two strings that represent the hand signs chosen by the human and computer, respectively, and returns the identifier of the winner. whoWins returns human, computer, or draw. whoWins must call the Boolean function beats(A, B), where A and B are selections (i.e., paper, rock, or scissors.) beats(A, B), returns true if A beats B, and false otherwise.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

The bonding properties of an atom is determined by

Answered: 1 week ago