ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## xorBy + [link](./xorBy "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L7023 "View in source.") + [npm](https://www.npmjs.com/package/lodash.xorby "See the npm package.") ``` _.xorBy([arrays], [iteratee=_.identity]) ``` 这个方法类似 `_.xor`,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。 ### 参数 1. [arrays] (...Array) 要处理的数组 2. [iteratee=_.identity] (Function|Object|string) 这个函数会处理每一个元素 ### 返回值 (Array) 包含了所有唯一值的新数组 ### 示例 ``` _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); // => [1.2, 4.3] // 使用了 `_.property` 的回调结果 _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); // => [{ 'x': 2 }] ```