去重数组

function dedupe(array) {

  return Array.from(new Set(array));

}

dedupe([1, 1, 2, 3]) // [1, 2, 3]

 

posted @ 2021-07-14 16:03  echolife  阅读(28)  评论(0编辑  收藏  举报