Need help to check winning conditions for a Tic-Tac-Toe game in Js : <p>I dont know how to check for the winning conditions.Could someone explain it to me step by step.I'll post my code. Im also new to coding.</p>

<p>prntscr.com/m06ew1</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
 &lt;head&gt;
    &lt;title&gt;Tic-Tac-Toe&lt;/title&gt;
    &lt;link rel="stylesheet" href="TicTacToe.css"&gt;
&lt;/head&gt;

&lt;body&gt;

    &lt;h1&gt; Tic-Tac-Toe game!&lt;/h1&gt;
        &lt;div class="grid"&gt;
                &lt;div class="grid-item" id="grid1" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid2" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid3" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid4" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid5" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid6" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid7" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid8" &gt;&lt;/div&gt;
                &lt;div class="grid-item" id="grid9" &gt;&lt;/div&gt;
        &lt;/div&gt; 

 &lt;/body&gt;
 &lt;script type="text/javascript" src="jquery-3.3.1.js" &gt;&lt;/script&gt;    
 &lt;script type="text/javascript" src="TicTacToe.js" &gt;&lt;/script&gt; 


        &lt;aside&gt;
            &lt;h2&gt;History&lt;/h2&gt;

        &lt;/aside&gt;

        &lt;section&gt;Player &lt;span id="player"&gt; &lt;b&gt;1&lt;/b&gt; &lt;/span&gt; it's your 
turn!&lt;/section&gt;

        &lt;footer&gt;
            Copyright Irfan - 2018
        &lt;/footer&gt;


&lt;/html&gt;

 JSFILE

$("document").ready (function(){


const player1 = 'X'
const player2 = 'O'
CurrentPlayer = 1



$(".grid-item").click (function(){
if(CurrentPlayer == 1) {
 $(this).html(player1);
 $("#player").html("&lt;b&gt;2&lt;b&gt;")
 CurrentPlayer = 2
  }

 else if ( CurrentPlayer ==  2) {
  $(this).html(player2);
  $("#player").html("&lt;b&gt;1&lt;b&gt;")
  CurrentPlayer =1
 }
  }); 
  });
</code></pre>

<p>here is my code and i link a print screen above.Its for a tic tac tow game sdfafsdfdfsafdfasdafsdafafdfasddasfasdfafsdfda</p>
