Skip to content

Instantly share code, notes, and snippets.

@MarvinJWendt
Created October 8, 2019 23:23
Show Gist options
  • Save MarvinJWendt/0916f2615f3542627b6f719f8f2f0c8e to your computer and use it in GitHub Desktop.
Save MarvinJWendt/0916f2615f3542627b6f719f8f2f0c8e to your computer and use it in GitHub Desktop.
Chaining JavaScript Functions
const log = console.log
const is = (x) => {
return {
plus: (plus) => {
return is(x + plus)
},
ten: () => {
return (x === 10)
},
minus: (minus) => {
return is(x - minus)
}
}
}
log(is(5).plus(5).ten())
log(is(5).plus(5).plus(1).ten())
log(is(10).ten())
log(is(11).minus(1).ten())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment