word/quiz: common js function to shuffle arrays
[sheet.git] / word / quiz.js
index 021758650c4c26a8eec2688fd98388f5916e63b0..70f8500bf2bffa30e0b5b899be79c3d561effc92 100644 (file)
@@ -1,7 +1,11 @@
+Array.prototype.shuffle = function () {
+       return this.sort(() => {return .5 - Math.random()});
+};
+
 class WordQuiz {
        dataselect(json) {
                let rows = Object.values(json);
-               return rows.sort(() => {return .5 - Math.random()}) // shuffle
+               return rows.shuffle();
        }
 
        load(dataurl) {