Tic Tac Toe winning pattern issue

Hi everyone,
I am doing the Tic Tac Toe challenge. I already have my winning patters but, I don’t know how to validate them. I was thinking that every time the user click a different blocks which have numbers as ID’s, it would send those numbers to an array and then that array would be compared to the array with the winning patters and check if any of those number match.

Something like this:
var wins =[“012”,“345”,“678”,“048”,“246”,“035”,“148”,“258”];

I decided to keep it as a string but any any way is fine.
Lets say I have this
var arr = [“015462”];//my arr with pushed numbers
var wins = [“012”,“345”];//sample of the winner patterns

how should I compare them since the numbers in the array are not organized into 3, they are all over the place. I need a function that can identfy the first pattern it finds. In the example above there is a winning pattern but it is all scrambled. How should I proceed?

You should store turns for each player into its own collection for easier/ maintainable code and then after each turn (or 3rd one) you can compare player’s (with turn) array with win pattern collection.