Javascript delete a table tbody tag
<p>I know I can use the following code to remove rows in vanilla Javascript:</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var table = document.getElementById('table');
    
function deleteRow () {
  table.deleteRow(1);
};</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>table { background: #ccc; width: 100%; }
table thead { background: #333; color: #fff; }
table tbody { background: magenta; color: #fff; }</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button onclick="deleteRow()"&gt;Delete Row&lt;/button&gt;
&lt;table id="table"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;td&gt;foo&lt;/td&gt;
        &lt;td&gt;bar&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;lorem&lt;/td&gt;
          &lt;td&gt;ipsum&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;lorem&lt;/td&gt;
          &lt;td&gt;ipsum&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;</code></pre>
</div>
</div>
</p>

<p>But this code leaves an empty tbody tag behing. JS has methods for removing thead and tfoot elements, but it seems it's missing a <code>deleteTbody</code> one. </p>

<p>How am I supposed to remove a <code>tbody</code> and all it's contents by using pure javascript only? No jQuery, please!</p>