title: how to append the button to each <li> tag in javascript using forEach loop
body: <p>I want to append the <code>button</code> tag to each of the 6 <code>li</code> tags using a <code>forEach</code> loop but after running the below code I am only getting a <code>button</code> tag on the 6th (last) <code>li</code> tag. Please help and let me what I am doing wrong.</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>var button = document.createElement('button');
  button.appendChild(document.createTextNode('delete'));
  var spam = document.createElement('spam');
  var li = document.querySelectorAll('li');
  
  li.forEach(function(i) {
    i.appendChild(button);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
    &lt;h1&gt;Shopping List&lt;/h1&gt;
    &lt;p id="first"&gt;Get it done today&lt;/p&gt;
    &lt;input id="userinput" type="text" placeholder="enter items"&gt;
    &lt;button id="enter" width='50px'&gt;Enter&lt;/button&gt;
    &lt;ul&gt;
      &lt;li class="bold red" random="23"&gt;Notebook&lt;/li&gt;
      &lt;li&gt;Jello&lt;/li&gt;
      &lt;li&gt;Spinach&lt;/li&gt;
      &lt;li&gt;Rice&lt;/li&gt;
      &lt;li&gt;Birthday Cake&lt;/li&gt;
      &lt;li&gt;Candles&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>