Created
August 29, 2017 17:14
-
-
Save Ankitashah212/6e76584a77f1db9c2d269a111eddf477 to your computer and use it in GitHub Desktop.
fizzbuzz
This file contains hidden or 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="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=<device-width>, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script> | |
for (var i = 1; i < 101; i++) { | |
var print = ""; | |
if (i % 3 == 0) { | |
print += "fizz"; | |
} | |
if (i % 5 == 0) { | |
print += "Buzz"; | |
} | |
if (print.length > 3) { | |
console.log(print + " "); | |
} | |
else { | |
console.log(i); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment