Skip to content

Instantly share code, notes, and snippets.

@pellepim
Created November 29, 2010 19:08
Show Gist options
  • Save pellepim/720389 to your computer and use it in GitHub Desktop.
Save pellepim/720389 to your computer and use it in GitHub Desktop.
function aClosedClosure(name){
var lastName = 'Dahlstrom';
return function(firstNameLocal){
if(firstNameLocal)
{
return firstNameLocal +' '+ lastName;
}
else
{
return lastName;
}
}
}
console.log(aClosedClosure()())
console.log(aClosedClosure()('Olle'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment