title: I would like to add a click eventlistener on each row elements of the table
body: <p>I created a 3x3 table for my tic-tac-toe game using the table tag and i added a click event listener to the each of the row using forEach loop but unfortunately nothing is showing in my console</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const boxes = document.querySelectorAll('.box');
  const strategy = document.querySelector('#strategy');
  const restartBtn = document.querySelector('#restart');
  const arry = [];
  const tick_x = 'X';
  const tick_o = 'O';
  const userAction = () =&gt; {
    boxes.forEach((box) =&gt; {
      box.addEventListener('click', function clk() {
        console.log("clicked")
      })
    })
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html {
    height: 100%;
  }
  
  body {
    margin: 0;
    padding: 0;
    background-color: teal;
    overflow: hidden;
    font-family: "Itim", cursive;
  }
  
  .game {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  p {
    color: white;
    text-align: center;
    margin: 40px auto;
    width: 200px;
  }
  
  table {
    margin-bottom: 50px;
    border-radius: 10px;
    border-top: 2px solid white;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    border-right: 2px solid white;
  }
  
  button {
    width: 100px;
  }
  
  h1 {
    width: 100%;
    height: 100%;
    text-align: center;
  }
  
  .row1 td {
    width: 100px;
    height: 100px;
    border-bottom: 1px solid white;
    border-left: 1px solid white;
  }
  
  .row2 td {
    width: 100px;
    height: 100px;
    border-bottom: 1px solid white;
    border-left: 1px solid white;
  }
  
  .row3 td {
    width: 100px;
    height: 100px;
    border-left: 1px solid white;
  }
  
  .r11 {
    border-left: none;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="intro"&gt;
    &lt;p class="name"&gt;TIC-TAC-TOE&lt;/p&gt;
    &lt;h2 id="strategy"&gt;&lt;/h2&gt;
    &lt;p class="player"&gt;Player X'S turn&lt;/p&gt;
  &lt;/div&gt;
  &lt;table&gt;
    &lt;tr class="row1"&gt;
      &lt;td class="r11"&gt;
        &lt;h1 class="box" id="0"&gt; &lt;/h1&gt;
      &lt;/td&gt;
      &lt;td class="r12"&gt;
        &lt;h1 class="box" id="1"&gt; &lt;/h1&gt;
      &lt;/td&gt;
      &lt;td class="r13"&gt;
        &lt;h1 class="box" id="2"&gt; &lt;/h1&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class="row2"&gt;
      &lt;td class="r21"&gt;
        &lt;h1 class="box" id="3"&gt; &lt;/h1&gt;
      &lt;/td&gt;
      &lt;td class="r22"&gt;
        &lt;h1 class="box" id="4"&gt; &lt;/h1&gt;
      &lt;/td&gt;
      &lt;td class="r23"&gt;
        &lt;h1 class="box" id="5"&gt; &lt;/h1&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class="row3"&gt;
      &lt;td class="r31"&gt;
        &lt;h1 class="box" id="6"&gt; &lt;/h1&gt;
      &lt;/td&gt;
      &lt;td class="r32"&gt;
        &lt;h1 class="box" id="7"&gt; &lt;/h1&gt;
      &lt;/td&gt;
      &lt;td class="r33"&gt;
        &lt;h1 class="box" id="8"&gt; &lt;/h1&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;button id="restart"&gt;&lt;h3&gt;Reset&lt;/h3&gt;&lt;/button&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>