Skip to content

Instantly share code, notes, and snippets.

@sinslav
Created June 30, 2015 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinslav/7d623ba0c7bd99940d4b to your computer and use it in GitHub Desktop.
Save sinslav/7d623ba0c7bd99940d4b to your computer and use it in GitHub Desktop.
functional fizzbuzz
function fizzbuzz (counter) {
if ((counter % 5 === 0) && (counter % 3 === 0)) return 'fizzbuzz';
if (counter % 3 === 0) return 'fizz';
if (counter % 5 === 0) return 'buzz';
return counter;
}
function consl () {
for (var i = 1; i <= 100; i++){
console.log(fizzbuzz(i));
}
}
consl();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment