(function(root){ function F(){}; root.inherits = function inherits(child, parent) { F.prototype = parent.prototype; //child.superClass_ = parent.prototype; child.prototype = new F(); //child.prototype.constructor = child; } })(this); function Mammal(){ console.log("I'm a mammal"); this.whatwhat = "what"; } function Cat(){ console.log("CAT WHAT: " + this.whatwhat ); Mammal.call(this); console.log("I'm a cat"); console.log("CAT WHAT: " + this.whatwhat ); } var c1 = new Cat(); inherits(Cat, Mammal); var c2 = new Cat(); console.log(c1.constructor, c2.constructor); console.log(typeof(c1), typeof(c2)); console.log(Object.prototype.toString.call(c1), Object.prototype.toString.call(c2));