var obj = { \'a\' : \'apple\', \'b\' : \'banana\', \'c\' : \'carrot\' }
If I do a
for(key in obj) { console.log( key + \' has a value
You could put the logic for the last item outside the loop:
var last_item = null; for(key in obj) { last_item = key; } console.log(last_item);