5 ms·
Isn't it just (untested, probably full of errors): function super(obj, method) { for (var p = obj.prototype; p; p = p.prototype) if (p[
by __david__ 12y ago
Isn't it just (untested, probably full of errors):
function super(obj, method) {
for (var p = obj.prototype; p; p = p.prototype)
if (p[method])
return p[method];
throw method+" not found";
}
then use:
subclass.prototype.overridden = function(x,y) {
super(this, 'some_overriden_method').call(this, x, y);
// ...
}
If so, that means it's just sugar. If not, what does it do differently?