Created
May 26, 2022 12:51
-
-
Save ihopeudie/66fbf66a1b4c9c83c6aa723ee8e83e3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WINTER = 'Зима'; | |
const SPRING = 'Весна'; | |
const SUMMER = 'Лето'; | |
const AUTUMN = 'Осень'; | |
const NO_SUCH_MONTH = 'Нет месяца с номером'; | |
function getYearPeriod(month) { | |
switch (month) { | |
case 1: | |
case 2: | |
case 12: | |
return WINTER; | |
case 3: | |
case 4: | |
case 5: | |
return SPRING; | |
case 6: | |
case 7: | |
case 8: | |
return SUMMER; | |
case 9: | |
case 10: | |
case 11: | |
return AUTUMN; | |
default: | |
return `${NO_SUCH_MONTH} ${month}`; | |
} | |
} | |
for (let month = 1; month <= 13; month++) { | |
console.log(getYearPeriod(month)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment