主题
zipWith
js
_.zipWith([arrays], [iteratee=_.identity])
此方法类似于 _.zip
,只是它接受 iteratee
来指定如何组合分组值。迭代器使用每个组的元素调用:(...group)。
¥This method is like _.zip
except that it accepts iteratee
to specify how grouped values should be combined. The iteratee is invoked with the elements of each group: (...group).
新增于
¥Since
3.8.0
参数
¥Arguments
[arrays]
(...数组):要处理的数组。¥
[arrays]
(...Array): The arrays to process.[iteratee=_.identity]
(函数):组合分组值的函数。¥
[iteratee=_.identity]
(Function): The function to combine grouped values.
返回
¥Returns
(数组):返回新的分组元素数组。
¥(Array): Returns the new array of grouped elements.
示例
¥Example
js
_.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
return a + b + c;
});
// => [111, 222]