1、_.chunk拆解 返回二维数组
_.chunk(['a', 'b', 'c', 'd'], 2);
// => [['a', 'b'], ['c', 'd']]
_.chunk(['a', 'b', 'c', 'd'], 3);
// => [['a', 'b', 'c'], ['d']]
2、_.compact过滤数组中的假值,例如false, null, 0, "", undefined, 和 NaN 都是被认为是“假值”。
_.compact([0, 1, false, 2, '', 3]);
// => [1, 2, 3]
3、_.concat数组拼接
var array = [1];
var other = _.concat(array, 2, [3], [[4]]);
console.log(other);
// => [1, 2, 3, [4]]
console.log(array);
// => [1]
4、_.difference数组排除(array, [values]) (要检查的数组,要排除的值)
_.difference([3, 2, 1], [4, 2]);
// => [3, 1]
5、 .differenceBy(array, [values], [iteratee=.identity]) (要检查的数组,要排除的值,迭代器)
_.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);
// => [3.1, 1.3]
// The `_.property` iteratee shorthand.
_.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
// => [{ 'x': 2 }]