Skip to content

Instantly share code, notes, and snippets.

@jasminegmp
Last active February 19, 2020 17:59
Show Gist options
  • Save jasminegmp/442d0b5383d2c2efb8adb3cf9f3cefa3 to your computer and use it in GitHub Desktop.
Save jasminegmp/442d0b5383d2c2efb8adb3cf9f3cefa3 to your computer and use it in GitHub Desktop.
let createUser = function(name){
return{
name,
sayNames: function() {console.log(this.name)},
dog: {
name: 'Jello',
sayNames: function() {console.log(name + "'s dog's name is " + this.name)}
}
}
}
let jasmine = createUser('Jasmine') // initialize object
jasmine.sayNames(); // will console.log out 'Jasmine'
jasmine.dog.sayNames(); // will console.log out 'Jasmine's dog's name is Jello'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment