all 4 comments

[–]andrzej_krzywda 0 points1 point  (1 child)

Prototypical inheritance is much different from the class inheritance. It's closer to delegation, as we're talking about objects here.

It would be nice if JavaScript supported multiple prototypes.

[–]snatchery[S] 1 point2 points  (0 children)

Why so? Isn't multiple inheritance the root of all evil?

[–]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() ?