Set 은 중복된 값을 허용하지 않는 고유한 객체이며, 수정이나 추가 적용될 때마다 === 와 동일한 연산이 이루어집니다.
function solution(nums) { const amount = nums.length/2; const result = [...new Set(nums)].length; return amount > result ? result : amount }