Skip to content

Instantly share code, notes, and snippets.

@ltfschoen
Created March 20, 2017 03:19
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 ltfschoen/5511077b6924cc2c41463ddbc910eb22 to your computer and use it in GitHub Desktop.
Save ltfschoen/5511077b6924cc2c41463ddbc910eb22 to your computer and use it in GitHub Desktop.
Lexically nested functions within enclosing function
// Lexically nested function definitions defined within enclosing function
function Sum(arg0) {
function Inner1(arg1) {
function Inner2(arg2) {
return arg0 + arg1 + arg2;
}
return Inner2;
}
return Inner1;
}
console.log(Sum(3)(4)(5));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment