Created
November 8, 2017 10:03
-
-
Save christiantakle/2a154ff17515bb1a8055ac58288e3408 to your computer and use it in GitHub Desktop.
Different examples of fizzbuzz in javascript
This file contains 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
const | |
whenDivisibleBy = (x, t, f) => n => (n % x == 0 ? t : f), | |
fizz = whenDivisibleBy(3, 'Fizz', ''), | |
buzz = whenDivisibleBy(5, 'Buzz', ''), | |
fizzBuzz = n => fizz(n) + buzz(n) || String(n); | |
//Array(...Array(100)).map((_,x) => fizzBuzz(x+1)) |
Author
christiantakle
commented
Nov 8, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment