title: Mustache.js getting current Index of an array
body: <p>On initial page load, we are loading a large json data object with news feeds.
  We are using Mustache.js and listing all the new feed headlines which is working great.</p>
  
  <p>We have a div area to display the details of the onClick news item.
  Since we have the data already loaded, I need to pass the index of the current item (array index) to grab the news item we need to get details from.</p>
  
  <pre><code>{{#Data}}
      &lt;li&gt;
         {{eventName}}&lt;br /&gt;
         {{eventLocName}}&lt;br /&gt;
         {{eventLocCity}}, {{eventLocST}}
      &lt;/li&gt;
  {{/Data}}
  </code></pre>
  
  <p>I would like to add an id to the <li> with the array index such as</p>
  
  <pre><code>{{#Data}}
      &lt;li id='{{Data.index}}'&gt;
         {{eventName}}&lt;br /&gt;
         {{eventLocName}}&lt;br /&gt;
         {{eventLocCity}}, {{eventLocST}}
      &lt;/li&gt;
  {{/Data}}
  </code></pre>
  
  <p>What is the syntax to get array index into my Mustache.js template?</p>
  
  <p><strong>UPDATED / WORKING</strong></p>
  
  <p>Once I get my <code>results</code> onto the DOM, I used the following JS to add the '<code>index</code>' into each array item. (select answer below code helped)</p>
  
  <pre><code>for (i in result)
  result[i].index = i;
  </code></pre>