/** * Sets prototype of this function to an instance of parent function * @param {function} parent */ Function.prototype.extend = function(parent) { this.prototype = Object.create(parent.prototype); this.prototype.constructor = this; return this; }