'Javascript: The Good Parts' provides this example regarding the “Constructor Invocation Pattern” (page 29-30).
var Quo = function (string) {
this.status = string;
};
Quo.prototype.get_status = function() {
return this.status;
};
var myQuo = new Quo("confused");
document.writeln(myQuo.get_status()); // returns confused
The section ends with, "Use of this style of constructor functions is not recommended. We will see better alternatives in the next chapter."
What’s the point of the example and strong recommendation against using this pattern?
Thanks.
The section ends with:
The bolded text means that you should read the next chapter to find better alternatives.
So, just go ahead and do that.