子オブジェクトの値でオブジェクトをソートするにはどうすればよいですか?
例:
[
{
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
}
}
]
それが最大値とは無関係なオブジェクトの順序であるべきですlast_message.timestamp
。
どうやってするの?