Re:The world's smallest and fastest classical JavaScript inh...
by camus2 on Saturday February 15, 2014 @10:13AM
(#7243978)
nodejs has the util.inherits function which gives you an extra super_ shortcut to the superclass constructor,it makes sense to use it in node.
[ Parent
| on HN ]
Re:The world's smallest and fastest classical JavaScript inh...
by kybernetikos on Saturday February 15, 2014 @03:07PM
(#7245105)
Quite right, if you're in node, you may as well use util.inherits, especially since it basically does exactly the same thing (plus super_ and constructor):
exports.inherits = function(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};