Last active
January 29, 2019 13:30
-
-
Save finalcut/9f6ed0b4ff5e55ce8ec72213b5c53e65 to your computer and use it in GitHub Desktop.
Odd or Even Number Function
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
<html> | |
<head> | |
<script type="text/javascript"> | |
// define a function | |
function isEven(numberToTest) | |
{ | |
var minVal = -1000000; | |
var maxVal = 1000000; | |
if(!isNaN(numberToTest) | |
&& numberToTest >= minVal | |
&& numberToTest <= maxVal | |
){ | |
return numberToTest % 2 === 0; | |
} | |
/* | |
more verbose way | |
if(numberToTest % 2 === 0){ | |
return true; | |
} else { | |
return false; | |
} | |
*/ | |
} | |
// call the function | |
isEven(); | |
</script> | |
</head> | |
<body> | |
this is a page containing a function to determine | |
if a number is odd or even. It is purely for demonstration purposes. | |
the min max test is not accurate/complete. | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment