Skip to content

Instantly share code, notes, and snippets.

@AlenVelocity
Created January 30, 2021 14:21
Show Gist options
  • Save AlenVelocity/dc79e46c814527ef9f1f982aa88b6e38 to your computer and use it in GitHub Desktop.
Save AlenVelocity/dc79e46c814527ef9f1f982aa88b6e38 to your computer and use it in GitHub Desktop.
Well
function fizzBuzz(max: number, fizz: number, buzz: number) {
for (let i = 0; i < max; i++) {
let out: any = ''
if (i % fizz === 0) out += 'Fizz'
if (i % buzz === 0) out += 'Buzz'
out = (!out) ? i : out
console.log(out)
}
}
fizzBuzz(100, 3, 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment