function solution(a, b) {
var answer = '';
const months=[];
const days=["FRI","SAT","SUN","MON","TUE","WED","THU"]
for(let i=0;i<7;i++){
if(i==1){
months.push(29);
continue;
}
if(i%2===0){
months.push(31)
}else{
months.push(30);
}
}
for (let i=0;i<5;i++){
if(i%2===0){
months.push(31)
}else{
months.push(30);
}
}
let howManyDays=0;
months.map((val,i)=>{
if(i<a-1){
howManyDays+=val;
}
})
howManyDays+=b;
const whatDay=(howManyDays%7-1);
answer=days[whatDay===-1?6:whatDay]
return answer;
}
무슨 요일인지 맞출 때 -1을 6으로 바꿔주어야 한다.