Skip to content

Instantly share code, notes, and snippets.

@lancetw
Created January 5, 2017 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lancetw/312aeaabe1e2c1082c8a2f5bf5f97395 to your computer and use it in GitHub Desktop.
Save lancetw/312aeaabe1e2c1082c8a2f5bf5f97395 to your computer and use it in GitHub Desktop.
var fact = (function (fact) {
return (function (f) {
return f(function (f) {
return fact(function (n) {
return f(f)(n)
})
})
})(function (f) {
return f(f)
})
})(function (f) {
return function (n) {
return n == 0 ? 1 : n * f(n - 1)
}
})
console.log(fact(5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment