title: How to check if an element is the last with this class?
body: <p>So if I have a list of elements and I want to find out which one of them is the last one with this class. How can I do it without JQuery? Maybe I can get its index somehow? </p>
  
  <p>in JQuery it would be something like that:</p>
  
  <pre><code>&lt;div class="div"&gt;1&lt;/div&gt;
  &lt;div class="div"&gt;2&lt;/div&gt;
  &lt;div class="div"&gt;3&lt;/div&gt;
  &lt;div class="div"&gt;4&lt;/div&gt;
  &lt;div class="div"&gt;5&lt;/div&gt;
  &lt;div&gt;6&lt;/div&gt;
  
  jQuery(document).on('click', '.div', function() {
  if ( $(this).is($(".div:last")) ) 
  {
     console.log($(this))
  }    
  });
  </code></pre>
  
  <p><a href="https://jsfiddle.net/g0zLsfzy/" rel="nofollow noreferrer">Link</a></p>