.distinct()
时间: 2023-09-24 21:06:00 浏览: 28
The `.distinct()` method is used to return a new array that contains only unique elements from the original array. It removes any duplicates from the original array and returns a new array with only distinct elements. The method does not modify the original array.
Example:
```javascript
const numbers = [1, 2, 2, 3, 4, 4, 5];
const uniqueNumbers = numbers.distinct(); // [1, 2, 3, 4, 5]
```
阅读全文