Skip to content

Instantly share code, notes, and snippets.

@ericelliott
Last active June 9, 2017 04:47
Show Gist options
  • Save ericelliott/40da3b01cc9d2b6c9e00 to your computer and use it in GitHub Desktop.
Save ericelliott/40da3b01cc9d2b6c9e00 to your computer and use it in GitHub Desktop.
Mouse Factory
let animal = {
animalType: 'animal',
describe () {
return `An ${this.animalType} with ${this.furColor} fur,
${this.legs} legs, and a ${this.tail} tail.`;
}
};
let mouseFactory = function mouseFactory () {
return Object.assign(Object.create(animal), {
animalType: 'mouse',
furColor: 'brown',
legs: 4,
tail: 'long, skinny'
});
};
let mickey = mouseFactory();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment