js判断一个数组是否有重复元素

const isPureArray = array => {
  return [...new Set(array)].length === array.length
}
console.info(isPureArray([1, 2, 3, 4])) // true
console.info(isPureArray([1, 2, 3, 2])) // false

posted on 2022-03-29 10:56  GameCat  阅读(42)  评论(0编辑  收藏  举报

导航