JavaScript Tic Tac Toe Win Checker is Wet
I think the nicest thing to do is to split your task into three bits, essentially you want to see if a row, column or diagonal has all the entries the same.

A row, column or diagonal can all be thought of just as a (1D) array.

In fact, these things are all the 'lines' (pictorially) that you can find in a 2D array (which span the whole array).

Now given a 2D array A, there's several ways to define a line, for instance the line which corresponds to the second row we can say is the pairs (i, j) such that i === 1 (and j can be anything). Similarly the left diagonal is the pairs (i, j) such that i === j.

Ok so I want to think of a line as a function, for instance I will think of the second row as the function

(i, j) =&gt; i === 1

OK, now given a line (which we represent as a function), I want to extract the elements of A which lie on that line, so I should traverse A, and for each element (i, j) I check if that element is in my line (i.e. if my function returns true for it) and if so include it in my result.

How to do this? Well I /want/ to be able to loop through a 2D array gracefully, sadly we can't do that in JS, so I'll just look at each row in turn, determine which elements of that row are in my line and keep them, something like.

function getSectionOf2DArray(arr, lineFunc) {
    return arr.map((row, i) =&gt; row.filter((_, j) =&gt; lineFunc(i, j)));
}


So now I have a 2D array still, the element at position i of the array is an array consisting of the things in row i which are in my line. If I flatten it I'll have the array of things in my line. I'm not sure if you're using node or are in the browser, so I'll write a flatten to be safe.

function getSectionOf2DArray(arr, sectionFunc) {
    return Array.prototype.concat.apply(
        [],
        arr.map((row, i) =&gt; row.filter((_, j) =&gt; sectionFunc(i, j)))
    );
}


Nearly there now, let me define the lines of a 2D array.

First the rows, well given a 2D array A, these are just the things (i, j) =&gt; i === k for k up to the length of the array.

const rowLines = array =&gt;
    Array(array.length)
        .fill(0)
        .map((_, k) =&gt; (i, j) =&gt; i === k);


Now the columns, similar story just with a slight reversal, now it's (i, j) =&gt; j === k

const colLines = array =&gt;
    Array(array.length)
        .fill(0)
        .map((_, k) =&gt; (i, j) =&gt; j === k);


Finally the diagonals, the left diagonal (i.e. starting in the top left) is (i, j) =&gt; i === j, while the right diagonal is (i, j) =&gt; i + j === A.length - 1

const leftDiag = array =&gt; (i, j) =&gt; i === j;
const rightDiag = array =&gt; (i, j) =&gt; i + j === array.length - 1;


(I have made leftDiag continue to be a function defined in terms of array just for consistency, it will make our life nicer later).

Great, so now if we do

const ourLines = array =&gt;
    rowLines(array)
        .concat(colLines(array))
        .concat(leftDiag(array))
        .concat(rightDiag(array));


Then ourLines is a function which takes an array and returns an array of lines (aka functions).

Now we just need to define a function which says whether an 'evaluated' (as in I have the actual elements rather than the function) line corresponds to a win, this is easy, it's just if all the elements are the same and not equal to undefined. If all the elements are the same then when we turn the array into a set it will have just one element

const win = evalLine =&gt; new Set(evalLine).size === 1 &amp;&amp; evalLine [0] !== undefined;


OK, now we should just go through our lines, get the actual array of elements in A they correspond to, and check if any is a win.

const winResults = array =&gt;
    ourLines(array).map(line =&gt; win(getSectionOf2DArray(array, line)));

const isThereAWin = array =&gt; winResults(array).includes(true);


In summary, 

const winChecker = squares =&gt; {
    const getSectionOf2DArray = (arr, sectionFunc) =&gt;
        Array.prototype.concat.apply(
            [],
            arr.map((row, i) =&gt; row.filter((_, j) =&gt; sectionFunc(i, j)))
        );

    const rowLines = array =&gt; Array(array.length).fill(0).map((_, k) =&gt; (i, j) =&gt; i === k);

    const colLines = array =&gt; Array(array.length).fill(0).map((_, k) =&gt; (i, j) =&gt; j === k);

    const leftDiag = array =&gt; (i, j) =&gt; i === j;
    const rightDiag = array =&gt; (i, j) =&gt; i + j === array.length - 1;

    const ourLines = array =&gt;
        rowLines(array)
           .concat(colLines(array))
           .concat(leftDiag(array))
           .concat(rightDiag(array));

    const win = evalLine =&gt; new Set(evalLine).size === 1 &amp;&amp; evalLine[0] !== undefined;

    const winResults = array =&gt; ourLines(array).map(line =&gt; win(getSectionOf2DArray(array, line)));

    const isThereAWin = array =&gt; winResults(array).includes(true);

    return isThereAWin(squares);
};


I hope you agree this pattern is nice. There are ways to write more concise things for your specific use case but this is simple and extendable.