function solution(num_list) {
var answer = [];
let evenCnt = 0;
let oddCnt = 0;
num_list.forEach(e => {e % 2 == 0 && evenCnt++});
num_list.forEach(e => {e % 2 == 1 && oddCnt++});
answer.push(evenCnt,oddCnt);
return answer;
}
forEach를 사용해서 짝수 일때는 evenCnt를 증가시켜줬고, 홀수 일때는 oddCnt를 증가 시켜줬다. forEach는 map처럼 각 요소에 대해 callback을 싱행하지만 map은 실행결과를 모은 새 배열을 return 해준다!