Skip to content

Instantly share code, notes, and snippets.

@pinchez254
Last active July 31, 2019 09:39
Show Gist options
  • Save pinchez254/67938d162fbc97918e58dba417a06784 to your computer and use it in GitHub Desktop.
Save pinchez254/67938d162fbc97918e58dba417a06784 to your computer and use it in GitHub Desktop.
solving Fizz Buzz with JavaScript. Task: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
// fizz buzz
for (a=1 ; a < 101 ; a ++){
a % 15 == 0
? console.log('fizzBuzz')
: a % 3 === 0
? console.log('fizz')
: a % 5 === 0
? console.log('Buzz')
: console.log(a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment