title: Cant remove tr elements inside of table with index
body: <p>I am trying to create a table, where I input elements from object.
  There are limited number of elements, that can be rendered on the page. So in order to see more, you will click on next/ previous, to see other &quot;page&quot;.</p>
  <p>The problem is, that I want to remove the indexes, that are not to be displayed.</p>
  <p>The logic on the bottom is I set min and max index and to see different page, I will increment these numbers by 10 ( to get 10 results on the page) but when I click on next button, I want to remove 0 - 10 and have only 10 - 20, but table.deleteRow(index) does nothing. (but table.deteteRow(1) does work)</p>
  <pre><code>function fill(){
          prices.forEach((element,index) =&gt;{
              const table = document.querySelector(&quot;table&quot;);
              const tr = document.createElement(&quot;tr&quot;);
              tableItems.appendChild(tr);
              
             
              if(index &gt;= min &amp;&amp; index &lt; max){
                  
                  const type = document.createElement(&quot;td&quot;);
                  const name = document.createElement(&quot;td&quot;);
                  const hours = document.createElement(&quot;td&quot;);
                  const photos = document.createElement(&quot;td&quot;);
                  const place = document.createElement(&quot;td&quot;);
                  const price = document.createElement(&quot;td&quot;);
  
                  type.innerHTML = element.type;
                  name.innerHTML = element.name;
                  hours.innerHTML = element.hours;
                  photos.innerHTML = element.photos;
                  place.innerHTML = element.place;
                  price.innerHTML = element.price;
  
                  tr.appendChild(type);
                  tr.appendChild(name);
                  tr.appendChild(hours);
                  tr.appendChild(photos);
                  tr.appendChild(place);
                  tr.appendChild(price);
              }
  
              if(index &gt; max){
                  table.deleteRow(index);
              }
      
              //
          });
      }
  
  
      buttonRight.addEventListener(&quot;click&quot;,()=&gt;{
          min = max;
          max = max + 10;
  
          fill();
      });
      buttonLeft.addEventListener(&quot;click&quot;,()=&gt;{
          max = min;
          min = min -10;
  
          fill();
      });
  </code></pre>