Skip to content

Instantly share code, notes, and snippets.

@JoabMendes
Created May 5, 2019 17:48
Show Gist options
  • Save JoabMendes/b0e8b5f64dd25b2dc7e06ce84fa5b5c7 to your computer and use it in GitHub Desktop.
Save JoabMendes/b0e8b5f64dd25b2dc7e06ce84fa5b5c7 to your computer and use it in GitHub Desktop.
Code review content html
<html>
<head>
<script>
window.setTimeout(runFizzBuzz,10); //to wait until the the div loads
function runFizzBuzz() {
for (i = 0; i < 101; i++) {
If (!i) continue;
If (((i % 15) && (i % 3) && (i % 5))) setSpanToText("mySpan",
i+"\n");
If (!(i % 15)) setSpanToText("mySpan", "FizzBuzz\n");
else If (!(i % 3)) setSpanToText("mySpan", "Fizz\n");
else If (!(i % 5)) setSpanToText("mySpan", "Buzz\n");
If (i = 100) alert("FizzBuzz done");
}
}
function setSpanToText(span, text) {
var span = document.getElementById(span);
span.innerHTML = span.innerHTML + text;
}
</script>
</head>
<body>
<span style="white-space:pre-line" id="mySpan"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment