From 372af07fd98b1b4c7040ba019799262e56ee6a1a Mon Sep 17 00:00:00 2001 From: lexx54 Date: Fri, 11 Dec 2020 10:34:04 -0400 Subject: [PATCH] added an if statement to catch when we click the last cup to toggle it --- drink-water/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/drink-water/script.js b/drink-water/script.js index 15fa0b3..c96d09d 100644 --- a/drink-water/script.js +++ b/drink-water/script.js @@ -10,6 +10,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')) { idx-- }