Computes the union of the passed-in arrays: the list of unique items, in order, that are present in one or more of the arrays.

返回数组中的并集

_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
=> [1, 2, 3, 101, 10]

源码:

1   _.union = function() {
2     return _.uniq(_.flatten(arguments, true));
3   };

 

 

 

posted on 2012-04-15 23:07  himanhimao  阅读(315)  评论(0编辑  收藏  举报