Skip to content

Instantly share code, notes, and snippets.

@omas
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save omas/97b297d9530b22255d67 to your computer and use it in GitHub Desktop.

Select an option

Save omas/97b297d9530b22255d67 to your computer and use it in GitHub Desktop.
ネタ系です,良い子は真似してはいけません!
<!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