Skip to content

Instantly share code, notes, and snippets.

@daiiz
Last active October 22, 2015 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daiiz/623827a61d1316bbaaa9 to your computer and use it in GitHub Desktop.
Save daiiz/623827a61d1316bbaaa9 to your computer and use it in GitHub Desktop.
var fb = function (n) {
for (var i = 1; i < n; i++) {
if (i % 15 === 0 ) {
console.log("FizzBuzz");
}else if (i % 5 === 0) {
console.log("Buzz");
}else if (i % 3 === 0) {
console.log("Fizz");
}else {
console.log(i);
}
}
}
fb(100);
<!doctype html>
<html>
<head>
<title>JavaScript</title>
</head>
<body>
<div id="stage">
</div>
<script>
var stage = document.querySelector('#stage')
var console = {
log: function (val) {
stage.innerHTML += val.toString() + '<br>';
}
}
</script>
<!-- srcに、JavaScriptファイル名を入れる -->
<script src="tamesi.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment