Skip to content

Instantly share code, notes, and snippets.

@thmain
Created December 25, 2022 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thmain/14f8b8543c0aa9893fb3e714696e6450 to your computer and use it in GitHub Desktop.
Save thmain/14f8b8543c0aa9893fb3e714696e6450 to your computer and use it in GitHub Desktop.
function add10 (a) {
return a + 10
}
function compound (f) {
return function (b) {
return f(f(b))
}
}
console.log( add10(10) ) // 20
console.log( compound(add10)(10) ) // 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment