Skip to content

Instantly share code, notes, and snippets.

@r17x
Last active January 7, 2022 03:49
Show Gist options
  • Save r17x/78b9724c79e7497c6f651e9eaf781fe7 to your computer and use it in GitHub Desktop.
Save r17x/78b9724c79e7497c6f651e9eaf781fe7 to your computer and use it in GitHub Desktop.
/**
* Example `FizzBuzz` with JavaScript (Pattern-Matching Like????????????) λ_(ツ)_/¯
* I Love this tweet
* @see https://twitter.com/cajuinaoverflow/status/1395022027204005889
* JavaScript will make You Crazy (Trust Me!)
*/
const FizzBuzz = n => ({
true: n,
[ n % 5 === 0]: "Buzz",
[ n % 3 === 0]: "Fizz",
[ n % 15 === 0]: "FizzBuzz",
[ n === 0 ]: 0,
}).true
// const ThisIsAFizzBuzz = n => [...Array(15).keys()].forEach(console.log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment