Question: What I have so far! const cardObject = { _intervalID: null, _counter: 50, _cards: ace,2,3,4,5,6,7,8,9,10,jack,queen,king.split(,), _suits: clubs diamonds hearts spades.split( ), }, getRandomCard: function() {
What I have so far!
const cardObject = {
_intervalID: null,
_counter: 50,
_cards: "ace,2,3,4,5,6,7,8,9,10,jack,queen,king".split(","),
_suits: "clubs diamonds hearts spades".split(" "),
},
getRandomCard: function() {
let index = Math.floor(Math.random() * this._cards.length);
return this._cards[index];
},
getRandomSuit: Function() {
index = Math.floor(Math.random() * this._suits.length);
return this._suits[index];
WHAT I NEED TO DO! Only interested in J, G, AND F loadImages: function() { // TODO [J]: Update img element src attribute with a randomly generated card and suit image file name // Hint: You will need to call getRandomCard() and getRandomSuit() to create image filename }, countDown: function() { // TODO [G]: Decrement and display count down value, and upon reaching 0 stop timer and display card image // Hint: You will need to call displayCountdown(), stopCountDownTimer() and loadImages() }, displayCountDown: function() { // TODO [F]: Update countdown span element with current countdown value // Hint: Get a reference to count down span and set the span textContent property with the counter }, startCountDownTimer: function(start) { // TODO [D]: Start timer, setting any appropriate object properties, with an interval of one second this._startCount = start; this._counter = this._startCount; this.displayCountDown(); this._intervalID = setInterval(this.countDown.bind(this), 1000); }, stopCountDownTimer: function() { // TODO [E]: Stop timer using object timer property // Hint: Will need to call clearInterval() }, 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); } } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
