title: Boolean flag in nested for loops, 2D arrays check (Javascript)
body: <p>I'm new developer and i have this question, thanks in advance.
  building an tic tac toe game. i want to a horizontal check, i got it to work with counter like this: </p>
  
  <pre><code>var currentPlayer = 'X';
  
  var ArrOfBoardRealTime = [['X','X','X'],
                            ['O','X','X'],
                            ['O','X','X']]; 
  
      function checkWinners() {
          var counter = 0;
          var winner;
  
          for(let i = 0; i &lt; ArrOfBoardRealTime.length &amp;&amp; counter &lt; 3; i++){
              for(let j = 0; j &lt; ArrOfBoardRealTime[i].length; j++){
                  if(ArrOfBoardRealTime[i][j] == currentPlayer){
                      counter++;
                  }  
              }
              if(counter == 3){
                  winner = currentPlayer + ' WON ,HORI-WAY';
  
              }else{
                  counter = 0;
                  winner = 'NO WIN';
              }
          }
          return winner;
      }
  </code></pre>
  
  <p>but i want to try to make it work with boolean flag to make it a bit shorter and better. 
  <strong>NOTE""I know im working on a loooong way to solve the tic tac toe, but im learning this to learn more""</strong></p>
  
  <p>now i've tried to solve it with boolean but it won't work, when i debugged it, it stops the check because it's false and it never enters the loop again. this is what i've tried :</p>
  
  <pre><code>var currentPlayer = 'X';
  
  var ArrOfBoardRealTime = [['X','X','X'],
                            ['O','X','X'],
                            ['O','X','X']];     
  
  
  function checkWinners() {
      var isWin = true; 
      for (var i = 0; i &lt; ArrOfBoardRealTime.length; i++ ){
          for(var j = 0; j &lt; ArrOfBoardRealTime[i].length &amp;&amp; isWin; j++){
              if (ArrOfBoardRealTime[i][j] != currentPlayer){
                  isWin = false;
              }
          }
  
      }
      return isWin;
  }
  </code></pre>
  
  <p>Im still learning and i'd appreciate your help and tips guys. 
  Thanks again.</p>