Add neighboring stones of the same color to form chains, with logging for isolated stones
You don't really need your elses. Move count++ to the if, and change your last if to !count.
Rather than using !=, you should really use &lt; and &lt;=. This means you you can use x + 1 &lt; boardSize rather than (x + 1) != (boardSize).
You should learn operator precedence, == happens before &amp;&amp;. And so you can remove even more parentheses.


And so you can use:

function checkChains(x, y, color, array)
{
    var count = 0;

    if (x + 1 &lt; boardSize &amp;&amp; stones[x + 1][y] == color)
    {
        addToChain(x, y, x + 1, y, array);
        count++;
    }

    if (x &gt; 0 &amp;&amp; stones[x - 1][y] == color)
    {
        addToChain(x, y, x - 1, y, array);
        count++;
    }

    if (y + 1 &lt; boardSize &amp;&amp; stones[x][y + 1] == color)
    {
        addToChain(x, y, x, y + 1, array);
        count++;
    }

    if (y &gt; 0 &amp;&amp; stones[x][y - 1] == color)
    {
        addToChain(x, y, x, y - 1, array);
        count++;
    }

    if (!count)
    {
        console.log("none!");
    }
}