Prototype Composition

Prototype Composition example with Object.assign and Object.create

var mammal = {
	lungCapacity: 200,
	breath() {return 'Breathing with ' + this.lungCapacity + ' capacity.'}
}

var dog = {
	catchTime: 2,
	bark() {return 'woof'},
	playCatch() {return 'Catched the ball in ' + this.catchTime + ' seconds!'}
}

var robot = {
	beep() {return 'Boop'}
}

var robotDogProto = Object.assign({}, robot, dog, {catchTime: 0.1})
var robotDog = Object.create(robotDogProto)

var livingDogProto = Object.assign({}, mammal, dog)
var livingDog = Object.create(livingDogProto)