var Pet = {
  init: function (options) {
    this.name = options.name
    this.born = options.born
    this.died = options.died
  }
}

var Dog = {
  init: function (breed, options) {
    Pet.init.call(this, options)
    this.breed = breed
  },
  age: function () {
    return (this.died || new Date().getFullYear()) - this.born
  }
}

var dog = Object.create(Dog)
dog.init('Labrador', {
  name: 'Roger',
  born: 1999,
  died: null
})

console.log(dog)
console.log(dog.age())
console.log(Object.getPrototypeOf(dog))
console.log(dog.constructor)

@@ -128,30 +128,151 @@
 %0A  %7D
-%0A%7D%0A%0Avar Dog = %7B%0A  init
+,%0A  age: function () %7B%0A    return (this.died %7C%7C new Date().getFullYear()) - this.born%0A  %7D%0A%7D%0A%0Avar Dog = Object.create(Pet, %7B%0A  init: %7B%0A    value
 : fu
@@ -293,24 +293,26 @@
  options) %7B%0A
+  
     Pet.init
@@ -332,24 +332,26 @@
 ptions)%0A    
+ 
+ 
 this.breed =
@@ -363,100 +363,18 @@
 d%0A  
-%7D,%0A  age: function () %7B%0A    return (this.died %7C%7C new Date().getFullYear()) - this.born
+  %7D
 %0A  %7D%0A%7D
+)
 %0A%0Ava

Add object literals in JavaScript