Created
March 3, 2021 13:28
-
-
Save hamidKMB/bcff886b14f87164be14a8e036c1a789 to your computer and use it in GitHub Desktop.
Leap Year Checking
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
//Leap year | |
function leapYear(year){ | |
if ( year % 4 == 0 ){ | |
if( year % 100 == 0){ | |
if( year % 400 == 0 ){ | |
return "IS Leap Year"; | |
} else { | |
return"NOT Leap Year"; | |
} | |
}else{ | |
return "IS Leap Year"; | |
} | |
}else{ | |
return "NOT Leap Year"; | |
} | |
} | |
var a = prompt("Enter the year you want to know"); | |
alert ( leapYear( a ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment