Last active
January 1, 2016 08:59
-
-
Save tomcha/8121840 to your computer and use it in GitHub Desktop.
javascriptでFizzBuzz書いてみた
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf8"> | |
<script type="text/javascript"> | |
var $html = ""; | |
for (var i = 1; i <= 100; i++){ | |
if( i % 15 == 0){ | |
$html += "FizzBuzz<br>"; | |
}else if( i % 3 == 0){ | |
$html += "Fizz<br>"; | |
}else if( i % 5 == 0){ | |
$html += "Buzz<br>"; | |
}else{ | |
$html += i + "<br>"; | |
} | |
} | |
document.write($html); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment