-
Notifications
You must be signed in to change notification settings - Fork 1
/
end.js
33 lines (23 loc) · 1023 Bytes
/
end.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const finalScore = document.querySelector('.score'),
scoreRemains = document.querySelector('.score__remains'),
button = document.querySelector('.end-btn'),
navBox = document.querySelector('.toggle__box')
const mostRecentScore = localStorage.getItem('mostRecentScore'),
MAX_QUESTIONS = localStorage.getItem('MAX_QUESTIONS'),
questionCounter = localStorage.getItem('questionCounter'),
finalScoreText = localStorage.getItem('finalScore'),
selectedThemeEnd = localStorage.getItem('selected-theme'),
selectedIconEnd = localStorage.getItem('selected-icon')
const theFinalText = finalScoreText
scoreRemains.innerText = `Got ${theFinalText} out of ${MAX_QUESTIONS} questions`
finalScore.innerText = mostRecentScore
if (selectedIconEnd) {
navBox.classList.toggle(selectedIconEnd)
}
if (selectedThemeEnd) {
document.body.classList.add(selectedThemeEnd)
}
function handleClick() {
return window.location.assign('index.html')
}
button.addEventListener('click', handleClick)