Created
October 10, 2011 11:04
-
-
Save polamjag/1275056 to your computer and use it in GitHub Desktop.
FizzBuzz on js
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
<html> | |
<body> | |
<script type="text/javascript"> | |
for (i=1; i<=100; i++) { | |
if (i%15 === 0) { | |
t = "Fizz Buzz"; | |
} else if (i%3 === 0) { | |
t = "Buzz"; | |
} else if (i%5 === 0) { | |
t = "Fizz"; | |
} else { | |
t = i; | |
} | |
document.write(t+"<br>"); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment