title: Javascript native equivalent to JQuery .each() & $(this)
body: <p>I have the following code which looks at each div with class <code>.comment</code> and shortens the text if more than 100 characters. Using JQuery.</p>
  
  <p>Question is how to convert to native javascript, I can't find equivalents for <code>.each()</code> or <code>$(this)</code> </p>
  
  <pre><code>var showChar = 100;
  var ellipsestext = "...";
  var moretext = "more";
  var lesstext = "less";
  $('.comment').each(function() {
      var content = $(this).html();
  
      if(content.length &gt; showChar) {
  
          var c = content.substr(0, showChar);
          var h = content.substr(showChar-1, content.length - showChar);
  
          var html = c + '&lt;span class="moreellipses"&gt;' + ellipsestext+ '&amp;nbsp;&lt;/span&gt;&lt;span class="morecontent"&gt;&lt;span&gt;' + h + '&lt;/span&gt;&lt;/span&gt;';
  
          $(this).html(html);
      }
  
  });
  </code></pre>
  
  <p>Is this possible?</p>