I have a deck of shuffled cards represented as an array. Currently, I am manually picking 2-5 cards from the 'myDeck' array and displaying them. Is there a better way to do this using a loop?
At the moment, I am using individual variables like:
let selectedCard1 = myDeck.shift()
let selectedCard2 = myDeck.shift()
and for displaying the cards, I am simply using:
console.log(selectedCard1 + selectedCard2)
Instead of using manual selections, is there a way to utilize a loop for this process? For example:
for(i = 0; i < 5; i++) {
myDeck.shift += i
return myDeck }
Any suggestions on how I can improve this process would be greatly appreciated.
Thank you in advance. Regards, Thomas