TIL | JS 윤년 판별기

cos·2022년 8월 18일
0
post-thumbnail

JavaScript 조건문 복습 중 간단한 윤년 판별기를 만들어보았다.

윤년 판별기

function answer(year) {
  let result;

  if (year % 4 == 0 && year % 100 != 0) {
    result = true;
  } else if (year % 4 == 0) {
    result = true;
  } else {
    result = false;
  }

  return result;
}
profile
The journey is the reward

0개의 댓글