Question: Step 5. 111/p4/p4.js A . Create an external JavaScript file called p4.js in your 111/p4 folder . B . Declare an object expression cardObject using

Step 5. 111/p4/p4.js

A. Create an external JavaScript file called p4.js in your 111/p4 folder.

B. Declare an object expression cardObject using the following code:

const cardObject = { /* TODO: Add the following properties: - timer ID property used for stopping timer - initial counter property starting value - counter property that will count down to zero - cards array initialized using a string and the split() method - suits array initialized using a string and the split() method */ getRandomCard: function() { // TODO: Return a random card value from the cards array // TODO: If card is 0, then use 10 to account for actual image file }, getRandomSuit: function() { // TODO: Return a random suit value from the suits array }, loadImages: function() { // TODO: Update img element src attribute with a randomly generated card and suit image file name }, countDown: function() { // TODO: Decrement and display count down value, and upon reaching 0 stop timer and display card image }, displayCountDown: function(num) { // TODO: Update countdown div element with current countdown value }, startCountDownTimer: function(start) { // TODO: Start timer, setting any appropriate object properties }, stopCountDownTimer: function() { // TODO: Stop timer using object timer property }, getRandomNumber: function(min, max) { // Generate a random integer between min (included) and max (excluded) let randomNum = Math.random() * (max - min) + min; return Math.floor(randomNum); } } const timedCard = Object.create(cardObject); timedCard.startCountDownTimer(5);

C. Implement the five object properties per instructions in the comments.

D. Implement and test startCountDownTimer() method per comments.

E. Implement and test stopCountDownTimer() method per comments.

F. Implement and test displayCountDown() method per comments.

G. Implement and test countDown() method per comments.

H. Implement and test getRandomCard() method per comments.

I. Implement and test getRandomSuit() method per comments.

J. Implement and test loadImages() method per comments.

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!