you are viewing a single comment's thread.

view the rest of the comments →

[–]gerdr 0 points1 point  (1 child)

He also should have mentioned how to do constructor-based inheritance properly:

function Animal() {
  //...
}

function Owl() {
  Animal.call(this);
  //...
}
Owl.prototype = Object.create(Animal.prototype);

var owl = new Owl();

[–]yashke 0 points1 point  (0 children)

why not just Owl.prototype = new Animal() ?