返回数组的所有不同值。
使用 ES6 Set和...rest运算符放弃所有重复的值。
Set
...rest
const distinctValuesOfArray = arr => [...new Set(arr)]; // distinctValuesOfArray([1,2,2,3,4,4,5]) -> [1,2,3,4,5]
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8