Files
Tic-Tac-Toe-Game/script/game-functions/checkVictory.js
2021-12-27 17:19:15 -03:00

13 lines
327 B
JavaScript

export default function checkVictory(combinations, boxes) {
const boxesSorted = boxes.sort()
combinations.forEach(combination => {
if (boxesSorted[0] === combination[0] && boxesSorted[1] === combination[1] && boxesSorted[2] === combination[2]) {
alert('Win')
}
});
}