Last active
January 7, 2022 03:49
-
-
Save r17x/78b9724c79e7497c6f651e9eaf781fe7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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