Question: Create a JavaScript program that contains a main class that will store information about the lucky number game and has the playGame() function. When a

Create a JavaScript program that contains a main class that will store information about the lucky number game and has the playGame() function. When a player pushes an HTML button, it will call back to a global function (Not the main class), which will then invoke the playGame() function from the instance of the main class

Inside the playGame() function - get a random number between 1 and 100, get a second random number between 1 and 100, if the 2nd number is higher, print "You Win", otherwise print you lose. Print the numbers as well. Keep track of how often you have won or lost and display it using a counter. If you have won more than lost, display : ) (happy face). If you have lost more than won, display : ( (sad face). If win == lose, display : | (neutral)

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!