@@Rolf B
Und seitdem finde ich die Seite nicht mehr wieder, die shuffle als Extension für Array.prototype definierte. Wo ist die bloß her?
Aus PHP. 😁
Jedenfalls nicht Standard-JavaScript.
Yo, muss man selbst hinzufügen:
// Fisher-Yates shuffle taken from https://javascript.info/task/shuffle
Array.prototype.shuffle = function () {
for (let i = this.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1)); // random index from 0 to i
[this[i], this[j]] = [this[j], this[i]];
}
};
🖖 Живіть довго і процвітайте
--
When the power of love overcomes the love of power the world will know peace.
— Jimi Hendrix
When the power of love overcomes the love of power the world will know peace.
— Jimi Hendrix