Created
January 24, 2023 11:48
-
-
Save vlazar-/12399ef66aaf44d1c1d822d5c5ada6b6 to your computer and use it in GitHub Desktop.
JavaScript - prijestupna godina
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Prijestupna Godina</title> | |
</head> | |
<body> | |
<script> | |
function isLeap(year) { | |
if (year % 4 === 0) { | |
if (year % 100 === 0) { | |
if (year % 400 === 0) { | |
return true; | |
} else { | |
return false; | |
} | |
} else { | |
return true; | |
} | |
} else { | |
return false; | |
} | |
} | |
let year = prompt('Unesi godinu:'); | |
alert(isLeap(year)); | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Prijestupna Godina</title> | |
</head> | |
<body> | |
<script> | |
function isLeap(year) { | |
if ((0 == year % 4) && (0 != year % 100) || (0 == year % 400)) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
let year = prompt('Unesi godinu:'); | |
alert(isLeap(year)); | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Prijestupna Godina</title> | |
</head> | |
<body> | |
<script> | |
function isLeap(year) { | |
let result = false; | |
if ((0 == year % 4) && (0 != year % 100) || (0 == year % 400)) { | |
result = true; | |
} | |
return result; | |
} | |
let year = prompt('Unesi godinu:'); | |
alert(isLeap(year)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment