Shuffling your deck
Here is my code
function shuffle (deck) {
let shuffleDeck = deck;
let currentIndex = deck.length;
let temporaryValue, randomIndex;
while (currentIndex != 0) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = shuffleDeck[currentIndex];
shuffleDeck[randomIndex] = temporaryValue;
}
return shuffleDeck;
}
I'm super new to coding so I'm just confused