function solution (numlist, n) { return numlist .sort((a, b) => b - a) .sort((a, b) => Math.abs(a-n) - Math.abs(b-n)); }
function solution(numlist, n) { return numlist .sort((a, b) => Math.abs(a - n) - Math.abs(b - n) || b - a); }
참고!! https://everyhahaha.tistory.com/entry/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-JS-%EB%A0%88%EB%B2%A8-0-%ED%8A%B9%EC%9D%B4%ED%95%9C-%EC%A0%95%EB%A0%AC-feat-sort