html tables in javascript code example

Example 1: table html

<table>
  <thead>
    <tr>
      <th>header1</th>
      <th>header2</th>
      <th>header3</th>
    </tr>
   </thead>
   <tbody>
     <tr>
       <td>text1.1</td>
       <td>text1.2</td>
       <td>text1.3</td>
     </tr>
     <tr>
       <td>text2.1</td>
       <td>text2.2</td>
       <td>text2.3</td>
     </tr>
     <tr>
       <td>text3.1</td>
       <td>text3.2</td>
       <td>text3.3</td>
     </tr>
     <tr>
     </tr>
  </tbody>
</table>

Example 2: creating a table in js

let table = document.createElement("table");

    for (let i = 0; i < 10; i++) {
        let tr = document.createElement('tr');
        let td = document.createElement('td');
        tr.appendChild(td);
        table.appendChild(tr);
    }
    target.appendChild(table);