Day 3 "Calendar"

Hector·2023년 3월 24일
0

Vanilla JavaScript

목록 보기
3/14
<script>
let month = new Date().getMonth()+1;
let lastDay = 0;

switch (month){
    case 1: case 3: case 5: case 7: 
    case 8: case 10: case 12:
    console.log('last day 31')
    lastDay=31;
    case 4: case 6: case 9: case 11:
    console.log('last dat 30')
    lastDay=30;
    break;
    case 2:
        if(new Date().getFullYear()%4 ===0){
            console.log('last dat 29')
        }else{
            console.log('last day 28')
        }
    }

console.log('last day ${lastDay}');
</script>
profile
I`m Studying Bankend

0개의 댓글