I thought I understood the concept of the JavaScript prototype object, as well as [[proto]] until I saw a few posts regarding class inheritance.
Firstly, “JavaScript OOP – the smart way” at http://amix.dk/blog/viewEntry/19038
See the implementation section:
var parent = new this('no_init');
And also “Simple JavaScript Inheritance” on John Resig’s great blog.
var prototype = new this();
What does new this(); actually mean?
This statement makes no sense to me because my understand has been that this points to an object and not a constructor function. I’ve also tried testing statements in Firebug to figure this one out and all I receive is syntax errors.
My head has gone off into a complete spin.
Could someone please explain this in detail?
AJS.Classeffectively* translates this:into this:
Therefore, in this case,
thisinAJS.Class.prototype.extendrefers toPerson, because:* There are a lot of cases I don’t go over; this rewrite is for simplicity in understanding the problem.