Skip to content

Instantly share code, notes, and snippets.

@jheth
Created September 21, 2015 17:34
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 jheth/6f22df7d1cd14f724d05 to your computer and use it in GitHub Desktop.
Save jheth/6f22df7d1cd14f724d05 to your computer and use it in GitHub Desktop.
Javascript Fizz Buzz
for (i = 1; i <= 100; i++) {
var f = (i % 3 == 0);
var b = (i % 5 == 0);
if (f && b) {
console.log('fizzbuzz', i);
} else if (f) {
console.log('fizz', i);
} else if (b) {
console.log('buzz', i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment