質問: { "bar": 15, "me": 75, "you": 100, "foo": 116 };
回答: var list = { "you": 100, "me": 75, "foo": 116, "bar": 15 }; var tmplist = {}; while (object.keys(list).length) { var key = object.keys(list).reduce((a, b) => list[a] > list[b] ? a : b); tmplist[key] = list[key]; delete list[key]; } list = tmplist; console.log(list); // { foo: 116, you: 100, me: 75, bar: 15 }