title: How to fix textContent as undefined inside of for loop?
body: <p>When i run the code below, it says "Cannot read property 'textContent' of undefined". Even onclick, addEventListener, length and much more says undefined! How can i fix this?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;div id = "dropdown-content" class = "d-con"&gt;
      &lt;a href = "#"&gt;America&lt;/a&gt;
      &lt;a href = "#"&gt;Canada&lt;/a&gt;
      &lt;a href = "#"&gt;Rio&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And The javaScript:</p>
  
  <pre><code>(function(){
      var i;
      var dropdown = document.getElementsByClassName('d-con');
      for(i = 0; i &lt;= dropdown.length; i = i + 1){
          alert(dropdown[i].textContent);
      }
  }()); 
  </code></pre>