Skip to content

Instantly share code, notes, and snippets.

@yomete
Created March 31, 2017 22:01
Show Gist options
  • Save yomete/6505ce4fa7281e5db8828fa7cb52da13 to your computer and use it in GitHub Desktop.
Save yomete/6505ce4fa7281e5db8828fa7cb52da13 to your computer and use it in GitHub Desktop.
FizzBuzz JavaScript solution
let num = 0
for (let counter = 0; counter < 100; counter++ ) {
num += 1
if ( num % 3 == 0 && num & 5 == 0) {
console.log ("FizzBuzz")
}
else if ( num % 3 == 0) {
console.log ("Fizz")
}
else if ( num % 5 == 0) {
console.log ("Buzz")
}
else {
console.log (num)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment