Reference
_.uniq
Removes all duplicates entries from an array.
- // Underscore/Lodash
- var result = _.uniq([1, 2, 1, 4, 1, 3]);
- console.log(result)
- // output: [1, 2, 4, 3]
- // Native
- var result = [... new Set([1, 2, 1, 4, 1, 3])]
- console.log(result)
- // output: [1, 2, 4, 3]
Browser Support for new Set()
38.0 ✔ | ✔ 12.0 | 13.0 ✔ | 11.0 ✔ | 25.0 ✔ | 7.1 ✔ |
当前内容版权归 you-dont-need 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 you-dont-need .