var prev_key = false; for (key in obj) { if(prev_key) { <code here> } prev_key = key; } <code here for last key>
This code would work better if you could get the first key of the object, so you could avoid if, but you cannot do it reliably in javascript (and still iterate in the same order in the loop).
Ariel source share