From cca89e3003d0dbf9f51ddf96d9c0b30ba0518a89 Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Tue, 5 Dec 2023 08:28:24 +0200 Subject: [PATCH] score and other bugs fixed --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index afafc07..5c45954 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ function nameSubmit() { name: sName, id: sId, startTime: new Date(), + score: 0, }; localStorage.setItem("studData", JSON.stringify(studData)); var privacyViolation = document.getElementById("privacyViolation"); @@ -97,7 +98,7 @@ const questions = [ generateQuestion(3, 7, 2, 7, 14, 21), generateQuestion(6, 6, 36, 6, 14, 21), ] -console.log(questions); +console.log(questions[0].answers); function setQ(n) { var question = document.getElementById("question") @@ -110,9 +111,10 @@ function setQ(n) { } } -var questionCounter = 0; +var questionCounter = 1; +setQ(questionCounter); function nextQ() { - if (questionCounter < questions.length) + if (questionCounter < questions.length - 1) questionCounter++; setQ(questionCounter); if (questionCounter < questions.length)