Created
July 4, 2019 18:49
-
-
Save jsmanifest/aae964a3daa2fdc643807f695e490fb9 to your computer and use it in GitHub Desktop.
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
| const someFunction = function() { | |
| const store = { | |
| people: { | |
| joe: { | |
| age: 16, | |
| gender: 'boy', | |
| }, | |
| bob: { | |
| age: 14, | |
| gender: 'transgender', | |
| } | |
| } | |
| } | |
| return { | |
| getPersonsProfile(name) { | |
| return store.people[name] | |
| }, | |
| foods: ['apple', 'pineapple'], | |
| } | |
| } | |
| const obj = someFunction() | |
| const joesProfile = obj.getPersonsProfile('joe') | |
| console.log(joesProfile) | |
| /* | |
| result: | |
| { | |
| age: 16, | |
| gender: boy, | |
| } | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment