需要按键排序对象数组

时间:2016-05-14 19:33:22

标签: javascript jquery sorting underscore.js

我有一个对象数组,我需要按键对每个对象进行排序。

//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函数来实现结果。

0 个答案:

没有答案