title: How to limit number of iterations when looping through object in nunjucks
body: <p>I have a js object like this:</p>
  <pre class="lang-js prettyprint-override"><code>var data = [
      { src: &quot;src1&quot;, name: &quot;name 1&quot; }, 
      { src: &quot;src2&quot;, name: &quot;name 2&quot; }, 
      { src: &quot;src3&quot;, name: &quot;name 3&quot; }
  ]
  </code></pre>
  <p>I am looping through it with Nunjucks:</p>
  <pre><code>{% for object in data %}
      {{object.src}}
  {% endfor %}
  </code></pre>
  <p>But I want to <em><strong>limit the number of iterations to 2.</strong></em></p>
  <p>How do I do that with Nunjucks?</p>
  <p>I know there is a range option but I couldn't find how to use it in this case.</p>