Skip to content

Instantly share code, notes, and snippets.

@dtinth
Last active October 20, 2015 15:12
Show Gist options
  • Select an option

  • Save dtinth/5cddb502cfc466972e51 to your computer and use it in GitHub Desktop.

Select an option

Save dtinth/5cddb502cfc466972e51 to your computer and use it in GitHub Desktop.
class Animal {
describe () {
return `An ${this.animalType} with ${this.furColor} fur,
${this.legs} legs, and a ${this.tail} tail.`
}
static mouse () {
return Object.assign(new Animal, {
animalType: 'mouse',
furColor: 'brown',
legs: 4,
tail: 'long, skinny',
})
}
}
Object.assign(Animal.prototype, {
animalType: 'animal',
})
let mickey = Animal.mouse()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment