Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created July 4, 2019 18:49
Show Gist options
  • Select an option

  • Save jsmanifest/aae964a3daa2fdc643807f695e490fb9 to your computer and use it in GitHub Desktop.

Select an option

Save jsmanifest/aae964a3daa2fdc643807f695e490fb9 to your computer and use it in GitHub Desktop.
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