title: How to check when a for loop has finished, inside the loop?
body: <p>Here is a quick jsfiddle I made to give a better example of my question.</p>
  
  <pre><code>function gi(id){return document.getElementById(id)}
  
      a= [1,5,1,2,3,5,3,4,3,4,3,1,3,6,7,752,23]
  
  
  for(i=0; i &lt; a.length; i++){
      /*
      if (WHAT AND WHAT){ What do I add here to know that the last value in the array was used? (For this example, it's the number: 23. Without doing IF==23.
  
      }
      */
  
      gi('test').innerHTML+=''+a[i]+' &lt;br&gt;';
  }
  </code></pre>
  
  <p>(the code is also available at <a href="https://jsfiddle.net/qffpcxze/1/" rel="noreferrer">https://jsfiddle.net/qffpcxze/1/</a>)</p>
  
  <p>So, the last value in that array is 23, but how can I know that the last value was looped in, inside the loop itself? (Without checking for a simple <code>IF X == 23</code>, but dynamically), if that makes sense. </p>