DEV Community

Discussion on: Pure and Simple - Tic Tac Toe with Javascript

Collapse
 
jrubino22 profile image
jrubino22

Hello Borna,
I am about a month into learning JS, so there is a lot of this code I do not understand.
Can you please explain what the purpose of this in the handleResultValidation() function is:

if (a === b && b === c)

Collapse
 
truepiotrek profile image
truepiotrek

Hey there, I hope I can help :)

First you take the winConditions which is the table with smaller tables marking all possible.. well, win conditions :D And with the code you are asking about you are checking if any of them is created using the same symbol (X or O). If those two conditions are met, the game ends with a win.