Skip to content

Instantly share code, notes, and snippets.

@battlejj
Created May 15, 2012 00:40
Show Gist options
  • Save battlejj/2698295 to your computer and use it in GitHub Desktop.
Save battlejj/2698295 to your computer and use it in GitHub Desktop.
Fizz Buzz
for(x = 1; x <= 100; x++){
var temp = [x, 'fizz', 'buzz', 'fizzbuzz'];
var pos = 0;
if(x%3 == 0){
pos += 1;
}
if(x%5 == 0){
pos += 2;
}
console.log(temp[pos]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment