How to get last element of array in ejs
<p>Am using nodejs as backend. </p>

<p>i need to retrieve last element of array in ejs.</p>

<p>this is my code:</p>

<pre><code>&lt;% for(var i=0; i &lt; user.booking.length; i++) { %&gt;
   &lt;%= user.booking[i].can_name %&gt;
   &lt;%= user.booking[i].can_quantity%&gt;
&lt;% } %&gt;
</code></pre>

<p>My output:</p>

<pre><code>Bisleri     3
Bisleri     3
Bisleri     4
Bisleri     4
Kinley      3
Bisleri     8
</code></pre>

<p>How can i get last value alone.</p>