From 0c7c21b64e44c36dda893aa07eff9df2b9338856 Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Tue, 5 Dec 2023 09:00:41 +0200 Subject: [PATCH] answerCheck() --- index.html | 8 ++++---- index.js | 13 ++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index cd9c602..01e9d49 100644 --- a/index.html +++ b/index.html @@ -43,12 +43,12 @@
- - + +
- - + +
diff --git a/index.js b/index.js index a90aa09..3432ea0 100644 --- a/index.js +++ b/index.js @@ -128,8 +128,15 @@ function prevQ() { setQ(questionCounter); } -} - -function questionSubmit() { +var past_users = [] +function answerCheck(n) { + const currentQuestion = questions[questionCounter]; + if (currentQuestion.answers[n].correct) + { + var user = JSON.parse(localStorage.getItem("studData")); + user.score += 1; + localStorage.setItem("studData", JSON.stringify(studData)); + } + nextQ(); }