Created
May 14, 2015 18:40
-
-
Save juancarloscruzd/b34fe7ea125dccf83790 to your computer and use it in GitHub Desktop.
FizzBuzz Test
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
var multiplo = function(value, digit){ | |
if(value % digit == 0){ | |
return true; | |
} else { | |
return false; | |
} | |
} | |
for(var i = 1; i <= 100; i++){ | |
if(multiplo(i, 3) && !multiplo(i, 5)){ | |
console.log("Buzz"); | |
} else if (multiplo(i, 5) && !multiplo(i, 3)){ | |
console.log("Fizz"); | |
} else if(multiplo(i, 3) && multiplo(i, 5)){ | |
console.log("BuzzFizz"); | |
} else { | |
console.log(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment