Skip to content

Instantly share code, notes, and snippets.

@chregon
Created September 1, 2020 07:14
Show Gist options
  • Save chregon/7a47eda72e1234cdaf5aa00bd7869bb8 to your computer and use it in GitHub Desktop.
Save chregon/7a47eda72e1234cdaf5aa00bd7869bb8 to your computer and use it in GitHub Desktop.
Fizzbuzz but can i do FP?
[...Array(30).keys()].forEach(x => console.log(((x % 3 === 0) ? (x % 5 === 0 ? "fizzbuzz" : "fizz") : ((x % 5 == 0) ? "buzz" : x))))
@chregon
Copy link
Author

chregon commented Sep 1, 2020

Outputs:
fizzbuzz
1
2
fizz
4
buzz
fizz
7
8
fizz
buzz
11
fizz
13
14
fizzbuzz
16
17
fizz
19
buzz
fizz
22
23
fizz
buzz
26
fizz
28
29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment