xxxxxxxxxx
function findClosestNumber(nums) {
nums = [new Set(nums)];
let ns = nums.sort((a, b) => Math.abs(a) - Math.abs(b));
return (ns[0] < 0 && Math.abs(ns[0]) === Math.abs(ns[1])) ? ns[1] : ns[0]
};
console.log(findClosestNumber([-4,-2,1,4,8])) // 1