Javascript looping get last loop : <p>I have array like this:</p>

<pre><code>[1,2,3,4,5,1,2,3,1,2,3]
</code></pre>

<p>My Question how can i'make the array just get the last loop,<br/> so will become like this:</p>

<pre><code>[5,3,3]
</code></pre>

<p>i try like this, but im confuse to, make condition</p>

<pre><code>for(var i=0; i &lt; arr.length; i++){
//how to make the looping just get bigger value before value 1
 console.log(arr[i]);
}
</code></pre>
