0
var arr = [{Analytics:26}, {Technology:22}, {Medical:40}, {Operations:90}]
輸出必須按順序排列。從操作,醫療,分析開始&技術。使用underscore.js選取多個屬性
輸出:
[90,40,26,22]
var arr = [{Analytics:26}, {Technology:22}, {Medical:40}, {Operations:90}]
輸出必須按順序排列。從操作,醫療,分析開始&技術。使用underscore.js選取多個屬性
輸出:
[90,40,26,22]
您可以用
var merged = Object.assign({}, ...arr);
合併的對象然後挑選出那些你想要的:
var output = [merged.Operations, merged.Medical, merged.Analytics, merged.Technology];
如果你喜歡純下劃線:
var merged = _.extend({}, ...arr);
_.map(['Operations', 'Medical', 'Analytics', 'Technology'], prop => merged[prop]);
管理命令是什麼? – 2016-08-18 19:33:57