Set contains only unique values. So, if there are duplicates in the nums array, then the length/size of the set will get reduced.
nums
var containsDuplicate = function(nums) { return new Set(nums).size !== nums.length; };