title: TypeError: row is undefined
body: <p>I need help with this JavaScript function I made. It works, but it always alerts me  with:</p>
  
  <blockquote>
    <p>"TypeError: row is undefined" </p>
  </blockquote>
  
  <p>when I launch it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>function checkRow(tableID){
          try{
          var table = document.getElementById(tableID);
          var rowCount = table.rows.length;
  
          for(var i = 1; i &lt;= rowCount; i++){
          var row = table.rows[i];
          var id = row.cells[1].innerHTML;
              if(i != id){
              document.getElementById(tableID).rows[i].cells[1].innerHTML = i;
                  }
              }
  
              }catch(e){
              alert(e);
              }
          }
  </code></pre>