From a1f8670521fd168852945d40c38d93e34e777a49 Mon Sep 17 00:00:00 2001 From: Joshua Date: Fri, 2 Feb 2024 08:29:05 +0100 Subject: [PATCH] New changes --- end.js | 2 +- html-quiz.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/end.js b/end.js index ec0afc2..94cabdd 100644 --- a/end.js +++ b/end.js @@ -17,7 +17,7 @@ const mostRecentScore = localStorage.getItem('mostRecentScore'), const theFinalText = finalScoreText scoreRemains.innerText = `Got ${theFinalText} out of ${MAX_QUESTIONS} questions` -finalScore.innerText = mostRecentScore + 1 +finalScore.innerText = +mostRecentScore //+1 if (selectedIconEnd) { navBox.classList.toggle(selectedIconEnd) diff --git a/html-quiz.js b/html-quiz.js index 5c62d51..e8c168b 100644 --- a/html-quiz.js +++ b/html-quiz.js @@ -37,8 +37,9 @@ fetch('questions.json') htmlQuestions = loadedQuestions MAX_QUESTIONS = htmlQuestions.length - + startGame() + }) //GAME FUNCTIONS @@ -53,8 +54,8 @@ const startGame = () => { availableQuestions = [...htmlQuestions] getNewQuestions() game.classList.remove('hidden') - - localStorage.setItem('avaliableQuestions', availableQuestions) + + } const getNewQuestions = () => { @@ -120,6 +121,9 @@ const incrementScore = num => { const incrementFinal = num => { finalScore += num + if(htmlQuestions.length === htmlQuestions) { + finalScore++ + } console.log(finalScore) }