hasDuplicates
Checks if there are duplicate values in a flat array.
- Use
Set()
to get the unique values in the array. - Use
Set.prototype.size
andArray.prototype.length
to check if the count of the unique values is the same as elements in the original array.