I'm currently trying to sort a objects properties bases on a value of the properties properties if that makes sense.
var obj = {
1: { name: "Mike", surname: "Smith"},
2: { name: "Albert", surname: "Einstein"},
3: { name: "Steve", surname: "Jobs"}
}
Say I want to sort the order of these properties by surname so the end result is
var obj = {
2: { name: "Albert", surname: "Einstein"},
3: { name: "Steve", surname: "Jobs"},
1: { name: "Mike", surname: "Smith"}
}
Surely there has to be an elegant way of doing this other than putting all the surnames into an array sorting that and then reconstructing the object.