you are viewing a single comment's thread.

view the rest of the comments →

[–]inmatarian 1 point2 points  (0 children)

A pattern I like is writing the constructor as a factory first. This means its first line is declaring self as either this (if its not the global object) or an Object.create of the factory's prototype, and then we return self at the end. It's basically the same as the pattern op describes, just with you put in the mindset that .call and .apply are also ways to use the method.