Skip to content

Instantly share code, notes, and snippets.

@juanmaguitar
Created September 29, 2017 09:40
Show Gist options
  • Save juanmaguitar/9389f930a7933a4cb56b83e95a2783f9 to your computer and use it in GitHub Desktop.
Save juanmaguitar/9389f930a7933a4cb56b83e95a2783f9 to your computer and use it in GitHub Desktop.
Function Composition Arrow Function
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