-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path3-leapYear.js
More file actions
40 lines (35 loc) · 797 Bytes
/
Copy path3-leapYear.js
File metadata and controls
40 lines (35 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function isLeapYear(year) {
if (year % 4 == 0 && year % 100 != 0) {
return true;
} else if (year % 400 == 0) {
return true;
} else {
return false;
}
}
const checkLeapYear = isLeapYear(1700);
console.log(checkLeapYear);
//solution number 2
function leapYear(year) {
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
return true;
} else {
return false;
}
}
console.log(leapYear(2000))
//solution number 3
function checkingLeapYear(year) {
if (year % 4 == 0) {
if (year % 100 != 0) {
return true;
} else if (year % 400 == 0) {
return true;
} else {
return false;
}
} else {
return false;
}
}
console.log(checkingLeapYear(2200))