From f8f6a5c823f411875b54777bf375393465dabf06 Mon Sep 17 00:00:00 2001 From: ElGurkus Date: Fri, 6 Nov 2020 10:46:21 +0100 Subject: [PATCH] changed code -> tiny change, actually done now --- code.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code.js b/code.js index 651b6dd..35ca851 100644 --- a/code.js +++ b/code.js @@ -25,7 +25,7 @@ let scoreO = 0; let scoreCounterO = 100; let gameOver = false; let winner; -let highScore; +let highScore = 0; let allowHSCookies; let saveChoiceCookie; let somethingIsSelected = false; @@ -450,8 +450,10 @@ function checkWinCondition(){ } else if(allowHSCookies && parseInt(highScore) < scoreO){ document.cookie = "highScore=" + scoreO + "; expires=Thu, 5 Dec 2030 12:00:00 UTC"; } - highScore = getCookie("highScore"); - document.getElementById("highScore").innerText = "Highscore: " + highScore; + if(allowHSCookies) { + highScore = getCookie("highScore"); + document.getElementById("highScore").innerText = "Highscore: " + highScore; + } } } function score (field){