Say I have an object like so…
object = {
thing0:{
date: 'Sat, 05 May 2012 01:00:00 EST'
},
thing1:{
date: 'Sat, 05 May 2012 12:00:00 EST'
},
thing2:{
date: 'Fri, 04 May 2012 06:00:00 EST'
}
}
I want to retrieve the thing that has the latest date. How could I create a function to quickly compare and retrieve this value?
There’s no shortcut, you’d need to do a
for..inloop to loop over the property names, and check each thing’sdate.