Skip to content

Instantly share code, notes, and snippets.

@radzionc
Last active August 18, 2017 20:59
Show Gist options
  • Save radzionc/090ecc8c62f07ea3c40dd65afb773a20 to your computer and use it in GitHub Desktop.
Save radzionc/090ecc8c62f07ea3c40dd65afb773a20 to your computer and use it in GitHub Desktop.
const dog = {
name: 'Ronni',
age: 4,
talk: function() {
retun `my name is ${this.name}`
}
}
// if you have some variables around
const name = 'Ronni'
const age = 4
const talk = function() {
retun `my name is ${this.name}`
}
// Power of JS
const dog = { name, age, talk }
// if you have dog object around you can extract properties this way
const { name, age, talk } = dog
const dogTold = talk()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment