How do I sort an object by the value of the child object?
Example:
[
{
name: 'Jhon',
old: 20,
last_message: {
text: 'blah',
timestamp: 1378188846
}
},
{
name: 'Bill',
old: 45,
last_message: {
text: 'Hello, Jhon!',
timestamp: 1378188956
}
},
{
name: 'Steave',
old: 34,
last_message: {
text: 'Bye! ;)'
timestamp: 1378188952
}
}
]
Should that be the order of objects independent of the maximum last_message.timestamp
.
How to do it?