From a60e70968be53687e4c92a580edcd7942bc76d52 Mon Sep 17 00:00:00 2001 From: Alvie Rahman Date: Thu, 13 Jan 2022 20:41:46 +0000 Subject: [PATCH] fix bug where switchins between modes doesn't update answer list --- game.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game.js b/game.js index 8c23e88..e16c26e 100644 --- a/game.js +++ b/game.js @@ -42,7 +42,7 @@ const getQuestionHTML = (state) => { return `what is the capital of ${state.question}?` } -const answer_list = Object.values(getMasterQuestionList()).map(item => item.answer); +const answer_list = () => Object.values(getMasterQuestionList()).map(item => item.answer); const regionList = [...new Set(Object.values(getMasterQuestionList()).map(item => item.region))] @@ -146,7 +146,7 @@ function updateState() { var newQuestion = questionList.pop(); var options = [] while (options.length < 4) { - var c = answer_list[Math.floor(Math.random()*answer_list.length)]; + var c = answer_list()[Math.floor(Math.random()*answer_list().length)]; if (c !== getMasterQuestionList()[newQuestion].answer && !options.includes(c)){ options.push(c); }