arr1 = [1, 2, 2, 3, 4, 5] const hasduplicate = array => new Set(array).size < array.length console.log(hasduplicate(arr1));