Array.prototype.shuffle = function() { let currentIndex = this.length, randomIndex; while (currentIndex != 0) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex--; [this[currentIndex], this[randomIndex]] = [this[randomIndex], this[currentIndex]]; } return this; }