getting the amount of properties in an object then getting the last one of them in a for loop
<p>This should be very easy but I don't know how to do it.</p>

<p>I have this object:</p>

<pre><code>var obj = eval(result);
</code></pre>

<p>Now I want to know how many properties contains to put it in a loop</p>

<pre><code>var finalAmount = obj.length;
</code></pre>

<p>Now I go for the loop</p>

<pre><code>for (var i in obj) {
    --- some other code in here
</code></pre>

<p>Now here the problem I need to do something when the loop reaches the final property of the obj, so this is what Ive tried:</p>

<pre><code>if (i+1 == finalamount){
    //do something
} else {
    //do something else
}
</code></pre>

<p>so basically using the <code>i</code> as a pointer to compare it to the var that contains how many items there are and when finding the final one of the loop then do something...</p>
