title: How do I find the last item in a js loop so I can add a class to it?
body: <p>I want to build a list. No problem.</p>
  
  <pre><code>for (i = 0; i &lt; 7; i++) {
      $('#domid').append(variable.clone());
  }
  </code></pre>
  
  <p>How do I get the LAST item in the list (in this case i.7) and add a class to it?</p>
  
  <pre><code>for (i = 0; i &lt; 7; i++) {
      $('#domid').append(variable.clone());
  
      if (i===7) {
          $('.domclass').addClass('last');
      };
  
  }
  </code></pre>
  
  <p>But that won't work. That just makes all of the .todo items have the class when the counter get's to 7.</p>
  
  <p>Any suggestions on how to find this?</p>
  
  <p>Thanks!</p>