Skip to content

hasDuplicates ​

判断数组中是否存在重复值。

使用 ​

ts
import { hasDuplicates } from 'rattail'

hasDuplicates([1, 2, 3, 2]) // true
hasDuplicates([1, 2, 3]) // false

参数 ​

参数类型默认值
arrArray

返回值 ​

类型
boolean

注意事项 ​

  • 如果数组中有任意值出现多次,则返回 true。
  • 使用严格相等进行比较。