In OOP inheritance is a sub-class adopting its parents protected and public attributes and methods upon instantiation. To continue to the use the Jot example, a basic Jot accepts two strings from the Controller. A username and a description_html string which contains html tags in a string format.

function Jot(username, description_html) {
this._username = username;
this._description_html = description_html;
}

Now the database stores the description in raw string format and html in case there are instances of the user not entering paragraph tags and using hard returns instead. So to edit a Jot the user may not want to see the additional formatting tags added in through using BeautifulSoup.

In which case we need a CleanJot object.

function CleanJot(username, description_html) {
Jot.call(this, username, description_html);
}
CleanJot.prototype.getDescription = function() {
return this._description_html.replace('<p>','\n');
}

The thing to note in the subclass is the use of call() which is an inbuilt Javascript method analogous to super() in Java. So if we instantiate CleanJot we have access to _username, _description_html and getDescription(). For example:

 clean = new CleanJot('cam','overunder');
alert(clean._description_html);
alert(clean.getDescription());
Does a prototype declaration over-ride a variable of the same name being set in a javascript constructor?

function Rock() {
  this.face = "mossy";
}
 
rock = new Rock(); alert(rock.face); Rock.prototype.face = "dry"; alert(rock.face); rock2 = new Rock(); alert(rock2.face);

The output is "mossy", "mossy" and "mossy". So the answer is no. (more)
Prototyping can also be used to add functionality to existing or core objects whose internal details you have no control over. This can be done without the need for subclassing the object and having to use inheritance to achieve that behavior.

Adding prototype functionality to the Date() object is a good example. A common cause of confusion between American and Australian dates is that the Month and Date are in opposite positions when dates are written in local shorthand.

For instance:

Date.prototype.getAustralianDate = function() {
  return (this.getDate() + '/'
+ this.getMonth() + '/'
+ this.getFullYear());
}
Date.prototype.getAmericanDate = function() {
return (this.getMonth() + '/'
+ this.getDate() + '/'
+ this.getFullYear());
}

And to test it:

d = new Date();
alert(d.getAustralianDate() + "\n" + d.getAmericanDate());

The alert shows the Australian style of date on the first line and the American style on the second line.
Cam Riley: South Sea Republic. Freedom, liberty, equity and an Australian Republic.