Skip to content

Instantly share code, notes, and snippets.

@vexdy
Created October 12, 2021 16:04
Show Gist options
  • Save vexdy/bf38363d06343c5cf0e935b6e3602066 to your computer and use it in GitHub Desktop.
Save vexdy/bf38363d06343c5cf0e935b6e3602066 to your computer and use it in GitHub Desktop.
FizzBuzz One Liner
// This is the way it comes to my mind in 10 seconds,
// there are should be better ways to do it faster but
// I want to make this as a one liner sooo.. yeah!
for(let i=1;i<101;i++){console.log((i%3==0&&i%15!==0)?'fizz':(i%5==0&&i%15!==0)?'buzz':i%15==0?'fizzbuzz':'')}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment