function solution(lottos, win_nums) {
const zero_count = lottos.filter((lotto) => lotto === 0).length;
const include_nums = lottos.filter((lotto) => win_nums.includes(lotto));
const high = include_nums.length + zero_count || 0;
const row = include_nums.length || 0;
const answer_obj = {
6: 1,
5: 2,
4: 3,
3: 4,
2: 5,
};
const answer = [answer_obj[high] || 6, answer_obj[row] || 6];
return answer;
}
배운점