-
Notifications
You must be signed in to change notification settings - Fork 0
/
end.js
31 lines (25 loc) · 848 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
import "./style.css";
const scoreTag = document.querySelector("#yourscore")
const gameStatus= document.querySelector("#yourstatus")
var retrievedObject = JSON.parse(localStorage.getItem("scoreTotal"));
scoreTag.innerHTML = retrievedObject["scoreTotal"]
var retrievedObject2 = JSON.parse(localStorage.getItem("status"));
gameStatus.innerHTML = retrievedObject2["status"]
console.log(retrievedObject)
var audio = new Audio("/music.wav");
const btn = document.querySelector("#soundOnEnd");
let playingSound = false;
btn.addEventListener("click", () => {
if (playingSound === false) {
audio.loop = true
audio.play();
btn.innerHTML = "Music Off 🚫";
playingSound = true;
console.log(playingSound);
} else {
audio.pause();
btn.innerHTML = "Music On 🎶";
playingSound = false;
return playingSound;
}
});