git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
word/quiz: common js function to shuffle arrays
[sheet.git]
/
word
/
quiz.js
diff --git
a/word/quiz.js
b/word/quiz.js
index 021758650c4c26a8eec2688fd98388f5916e63b0..70f8500bf2bffa30e0b5b899be79c3d561effc92 100644
(file)
--- a/
word/quiz.js
+++ b/
word/quiz.js
@@
-1,7
+1,11
@@
+Array.prototype.shuffle = function () {
+ return this.sort(() => {return .5 - Math.random()});
+};
+
class WordQuiz {
dataselect(json) {
let rows = Object.values(json);
class WordQuiz {
dataselect(json) {
let rows = Object.values(json);
- return rows.s
ort(() => {return .5 - Math.random()}) // shuffle
+ return rows.s
huffle();
}
load(dataurl) {
}
load(dataurl) {