Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

second revision #44

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html>
<html lang="en">
<head>
Expand All @@ -19,22 +19,19 @@
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/fizzbuzz.js"></script>
</head>

<body>

<div class="container">

<h1>Hello World!</h1>
<p class="lead">This is something!</p>

</div><!-- /.container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<div class="container">
<h1>Hello World!</h1>
<p class="lead">This is something!</p>
<script>
printnumber(15);
</script>
</div>
</body>
</html>
23 changes: 23 additions & 0 deletions js/fizzbuzz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* The debug function is an modified version of the one I read in OReilly Press's Javascript: THe Definitive Guide by David Flanagan */
function debug(msg) {
var leadcollection = document.getElementsByClassName("lead");
for (var i = 0, l = log.length; i < l; i++) {
var pre = document.createElement("pre");
var text = document.createTextNode(msg);
pre.appendChild(text);
leadcollection[i].appendChild(pre);
break;
}
}
function printnumber(N) {
for (var count = 1; count <= N; count++) {
if (count % 3 == 0 && count % 5 != 0)
debug("Fuzz");
else if (count % 5 == 0 && count % 3 != 0)
debug("Buzz");
else if (count % 15 == 0)
debug("FizzBuzz")
else
debug(count.toString())
}
}