Last active
January 28, 2018 12:39
-
-
Save tournasdim/8ab3dbec6a3ada0a92021369104b71c9 to your computer and use it in GitHub Desktop.
#nodejs Enclosure . Fun Facts : Being that enclosures have access to their outer functions variables and parameters, this allows the enclosures to be called later after the function returns and still be able to have access to these variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference : JavaScript for Experienced Developers | |
// https://www.youtube.com/watch?v=h50lRx3Myfo&list=PLknneukDQdN9sz45rtMkT3k0uq36d7rGj&index=141 (min 17:00) | |
function setFirstname(firstname) { | |
function appendLastName (lastname) { | |
console.log("My fullName is : " + firstname + " " + lastname ); | |
}; | |
return appendName; | |
} | |
var combineMyname = setFirstname("Tournas"); | |
combineMyname("Dimitrios") ; | |
// Result: | |
/* | |
root@root:/tmp/playground$ node test.js | |
My fullName is : Tournas Dimitrios | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment