JavaScript
const hasDuplicates = arr => new Set(arr).size !== arr.length
Examples
hasDuplicates([0, 1, 1, 2]) // true
hasDuplicates([0, 1, 2, 3]) // false
标签:arr,Set,检查,重复,数组,hasDuplicates
From: https://www.cnblogs.com/sunr/p/16664183.html