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());
(reply)
Cam Riley: South Sea Republic. Freedom, liberty, equity and an Australian Republic.