Last active
October 2, 2019 01:15
-
-
Save nivrith/0827adafd4c2cb6deb8830844e11d4b1 to your computer and use it in GitHub Desktop.
Functional utils
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 range = n => n > 0 ? [...range(n-1), n] : []; | |
const fact = n => n > 0 ? n * factorial(n-1) : 1; | |
const product = (...list) => list.flat(Infinity).reduce( (result, n) => result * n , 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment