From d4392e82363a20ce6c827971a3396ee7d05cbed3 Mon Sep 17 00:00:00 2001 From: Francisco Pessano Date: Mon, 27 Dec 2021 17:18:58 -0300 Subject: [PATCH] game logic bug fix --- script/game-functions/checkVictory.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/game-functions/checkVictory.js b/script/game-functions/checkVictory.js index be36f09..2c61cdd 100644 --- a/script/game-functions/checkVictory.js +++ b/script/game-functions/checkVictory.js @@ -1,10 +1,10 @@ export default function checkVictory(combinations, boxes) { - combinations.forEach(combination => { + const boxesSorted = boxes.sort() - const boxesSorted = boxes.sort() + combinations.forEach(combination => { - if (boxesSorted[0] === combination[0], boxesSorted[1] === combination[1], boxesSorted[2] === combination[2]) { + if (boxesSorted[0] === combination[0] && boxesSorted[1] === combination[1] && boxesSorted[2] === combination[2]) { alert('Win') }