ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## uniq + [link](./uniq "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L6854 "View in source.") + [npm](https://www.npmjs.com/package/lodash.uniq "See the npm package.") ``` _.uniq(array) ``` 创建一个不重复的数组副本。使用了 [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) 等值比较。只有首次出现的元素才会被保留。 ### 参数 1. array (Array) 需要处理的数组 ### 返回值 (Array) 返回不重复的数组 ### 示例 ``` _.uniq([2, 1, 2]); // => [2, 1] ```