function Animal (name) {
  console.log("Animal constructor is called " + name);
}

Animal.prototype.sleep = function () {
  console.log(this.name + ' is sleeping');
};

// extending the parent classe

function Cat (name) {
  console.dir(this.__proto__)
  this.name = name;
  // this.__proto__ = new Bar();
}

Cat.prototype = Animal.prototype;
Cat.prototype.constructor = Cat;

Cat.prototype.catchMice = function () {
  console.log(this.name + ' is catching mice');
};

// use the class

var cat = new Cat("Patches");
cat.sleep();
cat.catchMice();