假设我有一个数组数组,我想返回数组中每个数组的第一个元素:
array = [[["028A","028B","028C","028D","028E"],
["028F","0290","0291","0292","0293"],
["0294","0295","0296","0297","0298"],
["0299","029A","029B","029C","029D"],
["029E","029F","02A0","02A1","02A2"]],
[["02A3","02A4"],
["02A5", "02A6"]];
我知道我可以做这样的事情:
var firsts = [];
_.each(array, function(item){
_.each(item, function(thisitem){
firsts.push(_.first(thisitem));
});
});
但是如果我想用下划线的_.chain()
方法来做呢?只是学习下划线,到目前为止似乎很有用。