fullfish 2022. 9. 8. 11:58

코드

function solution(s) {
  return `${Math.min(...s.split(" ").map((ele) => parseInt(ele)))} ${Math.max(
    ...s.split(" ").map((ele) => parseInt(ele))
  )}`;
}

그런데 문자열도 Math.max와 min을 사용할 수 있었다

function solution(s) {
    const arr = s.split(' ');

    return Math.min(...arr)+' '+Math.max(...arr);
}