Created
December 7, 2021 09:56
-
-
Save sunnyy02/27df5f94de199063fd6fc533174146b7 to your computer and use it in GitHub Desktop.
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
compose = | |
(...fns) => | |
(initialVal) => | |
fns.reduceRight((val, fn) => fn(val), initialVal); | |
const getDiscountedPrice = compose(applyVipOffer, applyFixDiscount); | |
console.log('price:', getDiscountedPrice2(100)) // 40 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment