Skip to content

Instantly share code, notes, and snippets.

@teckliew
Created April 27, 2015 05:50
Show Gist options
  • Save teckliew/19c8443c7c28b59300d0 to your computer and use it in GitHub Desktop.
Save teckliew/19c8443c7c28b59300d0 to your computer and use it in GitHub Desktop.
My first JS FizzBuzz (to 100).
var x = 0, num = 0;
while (x<100){
num++;
if((num%3) === 0 && (num%5) !== 0 ){
console.log("Fizz");
}else if((num%3) !== 0 && (num%5) === 0){
console.log("Buzz");
}else if((num%3) === 0 && (num%5) === 0){
console.log("FizzBuzz");
}else{
console.log(num);
}
x++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment