Skip to content

Instantly share code, notes, and snippets.

@lorenmdavis
Created July 31, 2015 21:42
Show Gist options
  • Save lorenmdavis/aa57bb07c27e7c8606cb to your computer and use it in GitHub Desktop.
Save lorenmdavis/aa57bb07c27e7c8606cb to your computer and use it in GitHub Desktop.
FizzBuzz
var x = 0;
for(var x=0; x<=20; x++){
if(x%3===0){
console.log("Fizz");
}else if(x%5===0){
console.log("Buzz");
}else if(x%3===0 || x%5===0){
console.log("FizzBuzz");
}else{
console.log(x);
}
};
@lorenmdavis
Copy link
Author

var x = 1;
for(var x=1; x<=20; x++){
if(x%3===0 && x%5===0){
console.log("FizzBuzz");
}else if(x%5===0){
console.log("Buzz");
}else if(x%3===0){
console.log("Fizz");
}else{
console.log(x);
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment