javascript constructor reset: What is it ?

Posted by Sake on Stack Overflow See other posts from Stack Overflow or by Sake
Published on 2010-04-11T10:18:55Z Indexed on 2010/04/11 10:23 UTC
Read the original article Hit count: 258

Filed under:
|

I came across this slide: http://www.slideshare.net/stoyan/javascript-patterns#postComment

at page 35:

Option 5 + super + constructor reset

function inherit(C, P) {
    var F = function(){};
    F.prototype = P.prototype;
    C.prototype = new F();
    C.uber = P.prototype;
    C.prototype.constructor = C;  // WHY ???
}

I don't get it. Can anybody please explain what the last line for ?

    C.prototype.constructor = C;  // WHY ???

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about oop