Skip to content

Instantly share code, notes, and snippets.

/* ES5 code, without classes */
var Civilian = function Civilian(name) {
this.name = name;
};
Civilian.prototype.danger = function () { console.log("Run away!"); };
var SuperHero = function(name, ability) {
Civilian.call(this, name); // Call the super class constructor.
this.ability = ability;
};