Last active
March 26, 2017 04:42
-
-
Save dewey92/f93acea065ded7c5ecdbc0e867625b04 to your computer and use it in GitHub Desktop.
Compose step by step
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 wedhus = compose(hargaKambing, diskon10, times3, add2) | |
// sama dengan | |
const wedhus = x => [hargaKambing, diskon10, times3, add2].reduceRight((acc, fn) => fn(acc), x) | |
// dan | |
const hasil = wedhus(77) | |
// sama dengan | |
const hasil = [hargaKambing, diskon10, times3, add2].reduceRight((acc, fn) => fn(acc), 77) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment