const cards = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']; Array.prototype.shuffle = function() { for (let i = cards.length - 1; i > 0; i--) { const randomIndex = Math.floor(Math.random() * (i - 1)); const itemAtIndex = this[randomIndex]; this[randomIndex] = this[i]; this[i] = itemAtIndex; }; }; cards.shuffle(); console.log(cards);