Last active
January 13, 2016 15:55
-
-
Save JoseGonzalez321/da66fb19c3af340a8e3e to your computer and use it in GitHub Desktop.
Simple Closure example: https://jsbin.com/tihohi/edit?js,console
This file contains 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
var Person = (name, nickname) => { | |
return { | |
getFullName: () => name + ' (' + nickname + ')', | |
getName: () => 'Your name is: ' + name, | |
getNickname: () => 'People call you: ' + nickname, | |
}; | |
}; | |
var me = Person("Jose", "El Jefe"); | |
console.log(me.getFullName()); | |
console.log(me.getName()); | |
console.log(me.getNickname()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment