title: ForEach ES6 didn't work
body: <p>I've problem with forEach ES6. I wrote function which add element 'div' used pure javascript. I wanted remake code to ecmascript 6 and now code didn't work. Why?  I think that code is write correct wrote in ecmascript 6.</p>
  
  <p>Thanks for the help  </p>
  
  <p>This code works:</p>
  
  <p>Javascript</p>
  
  <pre><code>function addElement() {
  let linkToGallery = document.getElementsByClassName("gallery-1");
  for (var i = 0; i &lt; linkToGallery.length; i++) {
      linkToGallery[i].addEventListener('click', () =&gt; {
          const newDiv = document.createElement("div");
          const newDiv2 = document.createElement("div");
          newDiv.id = "buttonGallery";
          newDiv2.innerHTML = "";
          newDiv2.innerHTML += "&lt;div id='test'&gt;Test&lt;/div&gt;";
          document.body.appendChild(newDiv);
          document.body.appendChild(newDiv2);
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this code didn't works why if is the same?</p>
  
  <p>Ecmascript 6</p>
  
  <pre><code>function addElement() {
  let linkToGallery = document.getElementsByClassName("gallery-1");
  linkToGallery.forEach((current) =&gt; {
      current.addEventListener('click', () =&gt; {
          const newDiv = document.createElement("div");
          const newDiv2 = document.createElement("div");
          newDiv.id = "buttonGallery";
          newDiv2.innerHTML = "";
          newDiv2.innerHTML += "&lt;div id='test'&gt;Test&lt;/div&gt;";
          document.body.appendChild(newDiv);
          document.body.appendChild(newDiv2);
      });
  });
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks for the help.</p>