我有一个对象数组,我需要按键对每个对象进行排序。
//original array of objects
[ { "week1" : "10", "week2": "20", "week3" : "23"},
{"week2" : "40", "week1", "30", "week3" : "24'}];
//expected resultant array
[ { "week1" : "10", "week2": "20", "week3" : "23"},
{ "week1" : "30", "week2": "40", "week3" : "24"}];
我想使用JavaScript函数或使用任何underscore.js函数来实现结果。