문자열 내 마음대로 정렬하기

코드
function solution(strings, n) {
strings.sort((a, b) => {
if (a[n] > b[n]) return 1;
else if (a[n] < b[n]) return -1;
else if (a > b) return 1;
else if (a < b) return -1;
else return 0;
});
return strings;
}
sort안에 function을 잘 지정해주면 된다