I'm new at JS - and like many JS-beginners I'm somewhat confused about property-inheritage. As far as I understood a constructor function owns a property called prototype. This property points to a prototype-object. So when I define two constructors like:
function Super(){
this.x = 1 }
and
function Sub(){
this.y = 2 }
they will both point to a prototype-object.
With the following line of code Sub will inherit the property of Super:
Sub.prototype = new Super();
Now the question: what exactly happens here? Will the "old" prototype-object - which is pointed by Sub.prototype - just be replaced by the new object created with new Super()?
Kind regards Henning