문제풀이 : 5분 32초
요약
1. split, sort, filter, join method의 활
2. 최대값, 최소값 => Math.min, Math.max
function solution(s) {
return s.split(" ")
.sort((a, b) => a - b)
.filter((_, idx, arr) => idx === 0 || idx === arr.length -1 )
.join(" ");
}
function solution(s) {
const arr = s.split(" ");
const min = Math.min(...arr);
const max = Math.max(...arr);
return min +" "+ max;
}