4 ms·
no, it introduces a "super" semantic with late binding ,something you can't do in ES5. So it isn't just syntactic sugar. Furthermore it may evolve in later vers
by aikah 12y ago
no, it introduces a "super" semantic with late binding ,something you can't do in ES5. So it isn't just syntactic sugar. Furthermore it may evolve in later versions of ES to something even more complicated with access modifiers and things like that.
- __david__ 12y agoIsn'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?