Last active
October 7, 2020 03:49
-
-
Save snghnishant/7578b51659c2ffb2d4d35899dee565d9 to your computer and use it in GitHub Desktop.
FizzBuzz in JavaScript
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
function fizzbuzz(){ | |
for(var i=1; i<=100; i++){ | |
var myvar = ""; | |
if(i%3 === 0) myvar += "Fizz"; | |
if(i%5 === 0) myvar += "Buzz"; | |
if(myvar == "") myvar = i; | |
console.log(myvar); | |
} | |
} | |
fizzbuzz(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment