X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/1d2520bda414941f00a57e0d6fac73366f22ffcf..a8e02f8948b961a27b47965e0eab1fcc1c207915:/word/quiz.js diff --git a/word/quiz.js b/word/quiz.js index 361d075..146aff7 100644 --- a/word/quiz.js +++ b/word/quiz.js @@ -8,11 +8,16 @@ Array.prototype.shuffle = function () { class WordQuiz { dataselect(json) { + // find viable rows from json data let rows = Object.values(json); + if (this.preset.level !== undefined) { + rows = rows.filter(row => row[1] <= this.preset.level); + } return rows.shuffle(); } load(dataurl) { + this.preset = {}; fetch(dataurl).then(res => res.json()).then(json => { this.words = this.dataselect(json) this.setup();