krutoy, на здоровье
/**
* Inherits a target (Class_1) from a source (Class_2)
* @param {Function} target
* @param {Function} source
*/
function inherit(target, source) {
target.prototype = Object.create(source.prototype);
target.prototype.constructor = target;
target.super_ = source;
}
// ---------------------
function FormField(data) {
this._d = data;
}
// -------------------------
inherit(FormFile, FormField);
function FormFile(data, opts) {
FormFile.super_.apply(this, arguments);
this.opts = opts;
}
// -------------------------
var a = new FormFile(1, 2);
var b = new FormFile(10, 22);
console.log(a, a instanceof FormField, b instanceof FormField);
console.log(b, a instanceof FormFile, b instanceof FormFile);