Last active
August 29, 2015 14:03
-
-
Save omas/97b297d9530b22255d67 to your computer and use it in GitHub Desktop.
ネタ系です,良い子は真似してはいけません!
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> | |
| <script> | |
| (function main(){ | |
| var input = Math.abs(Number(prompt("数字をいれてね"))); | |
| if (isOdd(input)) { | |
| output(input + " is odd"); | |
| } else { | |
| output(input + " is even"); | |
| } | |
| })(); | |
| function isOdd(input){ | |
| var odd = false; | |
| while(input > 0){ | |
| if (input === 1) { | |
| odd = true; | |
| } | |
| input -= 2 ; | |
| } | |
| return odd; | |
| } | |
| function output(text){ | |
| alert(text); | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment