Created
September 29, 2017 09:40
-
-
Save juanmaguitar/9389f930a7933a4cb56b83e95a2783f9 to your computer and use it in GitHub Desktop.
Function Composition Arrow Function
This file contains hidden or 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 sum = (a,b) => a+b | |
const multiplication = (a,b) => a*b | |
const showResult = msg => fn => (a,b) => `${msg} ${fn(a,b)}` | |
showResult("sum is ")(sum)(2,4) // sum is 6 | |
showResult("result = ")(multiplication)(2,4) // result = 8 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment