title: tic_tac_toe winnerSelection loop
body: <pre><code>function calculateWinner(squares) {
    const lines = [
      [0, 1, 2],
      [3, 4, 5],
      [6, 7, 8],
      [0, 3, 6],
      [1, 4, 7],
      [2, 5, 8],
      [0, 4, 8],
      [2, 4, 6],
    ];
    for (let i = 0; i &lt; lines.length; i++) {
      const [a, b, c] = lines[i];
      if (squares[a] &amp;&amp; squares[a] === squares[b] &amp;&amp; squares[a] === squares[c]) {
        return squares[a];
      }
    }
    return null;
  }
  </code></pre>
  
  <p>This is a Tutorial in Reactjs.org while creating a function for declaring a winner i encountered this logic!!!!</p>
  
  <p>Is this "square[a]&amp;&amp;" logical error in the tutorial of Tic Tac Toe in reactjs.org it seems that the condition only should be <code>if(squares[a]===squares[b]&amp;&amp;squares[a]==squares[c]){ return square[a]; }</code> I am not understanding some logic myself or the code has logical error ?</p>