프로그래머스 - 최댓값과 최소값띄어쓰기로 각 숫자를 구분한 문자열이 들어올 때 해당 문자열에서 최댓값과 최소값을 리턴하는 문제이다. 먼저 작성한 코드function solution(s) { let numArr = s.split(' ').sort((a,b) => a-b) let positiveNum = [] let negativeNum = [] numArr.map((num) => Number(num)>0 ? positiveNum.push(Number(num)) : negativeNum.push(Number(num)) ) if (positiveNum.length === 0) { return [negativeNum[0], negativeNum[negativeNum.len..