数组去重

JavaScript

const uniqueElements = arr => [...new Set(arr)]

Examples

uniqueElements([1, 2, 2, 3, 4, 4, 5]) // [1, 2, 3, 4, 5]

posted on 2022-09-07 09:37  小馬過河﹎  阅读(10)  评论(0)    收藏  举报

导航