Skip to content

Instantly share code, notes, and snippets.

@ihopeudie
Created May 26, 2022 12:51
Show Gist options
  • Save ihopeudie/66fbf66a1b4c9c83c6aa723ee8e83e3a to your computer and use it in GitHub Desktop.
Save ihopeudie/66fbf66a1b4c9c83c6aa723ee8e83e3a to your computer and use it in GitHub Desktop.
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