From 4664cb02b269c7d2d03cdcad9a40147ee25df537 Mon Sep 17 00:00:00 2001 From: Rohit Bajaj Date: Sat, 23 Jan 2021 22:38:36 +0530 Subject: [PATCH] Fixing all cups selected bug --- drink-water/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drink-water/script.js b/drink-water/script.js index c96d09d..2bae482 100644 --- a/drink-water/script.js +++ b/drink-water/script.js @@ -11,7 +11,7 @@ smallCups.forEach((cup, idx) => { function highlightCups(idx) { if (idx===7 && smallCups[idx].classList.contains("full")) idx--; - if(smallCups[idx].classList.contains('full') && !smallCups[idx].nextElementSibling.classList.contains('full')) { + else if(smallCups[idx].classList.contains('full') && !smallCups[idx].nextElementSibling.classList.contains('full')) { idx-- } @@ -46,4 +46,4 @@ function updateBigCup() { remained.style.visibility = 'visible' listers.innerText = `${2 - (250 * fullCups / 1000)}L` } -} \ No newline at end of file +}