why is it
Foo.prototype = Object.create(Bar.prototype)
in order to let Foo "inherit" from Bar and not
Foo = Object.create(Bar)
or at least
Foo.prototype = Object.create(Bar)
... because isn't Bar.prototype
already the "class" which Bar is in turn "inheriting" from ? Speaking of the prototype-chain (Why is it necessary to set the prototype constructor?)
But obviously, Foo.prototype
means some hugely different thing than Foo.[[Prototype]]
. The first one meaning things that are shared among all the instances of
new Foo(args)
such as in
a = new Foo(args)
b = new Foo(args)
Intuitively, this
and Foo.prototype
seem more like a distinction for instances between "instance-methods/attributes" on one side and "class-level-methods/attributes" than some kind of inheritance.