Created
January 10, 2018 17:02
-
-
Save astout/c6fc5cdbbfb3c53c91ce968d9c99ae14 to your computer and use it in GitHub Desktop.
FizzBuzz Interview Practice
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(fizz = 3, buzz = 5, max = 100) { | |
for (let i = 0; i <= max; i += 1) { | |
if (i % fizz === 0 && i % buzz === 0) { | |
console.log('fizzbuzz'); | |
} else if (i % fizz === 0) { | |
console.log('fizz'); | |
} else if (i % buzz === 0) { | |
console.log('buzz'); | |
} else { | |
console.log(i); | |
} | |
} | |
} | |
fizzbuzz(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment