title: Loop through h3 elements
body: <p>everybody. I wanna make a <code>for</code> loop outputting my <code>h3</code> elements.  I could do it for one of them but to have them all, it doesn't output the content.
  And the <code>a</code> in the loop is for making inner links of my <code>h3</code> in a long page.</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>function showH() {
    var x = document.getElementsByTagName("H3");
  
    let str = '&lt;a href=""&gt;';
    for (var i =0; i &lt; x.length; i++) {
      str += x[i] + "&lt;/a&gt;";
    }
    document.getElementById("get").innerHTML = str;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p id="get"&gt;&lt;/p&gt;
  &lt;button onclick="showH()"&gt;click&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><strong>this code outputs:</strong></p>
  <pre><code>[object HTMLHeadingElement][object HTMLHeadingElement][object HTMLHeadingElement][object HTMLHeadingElement]
  </code></pre>