Question: Using JavaScript 1) Create a variable named CARD_COUNT and assign it a default value of 52. Create a function named shuffle with no parameters.
Using JavaScript 1) Create a variable named CARD_COUNT and assign it a default value of 52. Create a function named shuffle with no parameters. i. ii. 111. Add a for loop with 52 iterations (use the CARD_COUNT variable for this). During each iteration, generate a random number (see the below random card expression) between 0 and 52 and assign it to a variable named secondCard. Find the first card in the cards array by using the for loop's iteration variable (I named mine firstCard) and assign it to a variable named temp.Card. Reorder the cards array by setting the current card to the secondCard and the second card to the tempCard Random card expression: Math.floor(Math.random() this.CARD COUNT) Additional Programming Assistance let tempCard = this.cards[firstCard]:
Step by Step Solution
3.48 Rating (161 Votes )
There are 3 Steps involved in it
javascript let CARDCOUNT 52 function shuffle for let i 0 i CARDCOUNT i let secondCard MathfloorM... View full answer
Get step-by-step solutions from verified subject matter experts
