News for hackers. Stuff that matters.
Re:This is the page that made doing OOP in Javascript click ... by gnaritas on Thursday September 11, 2008 @04:09PM (#301714)
You can stick public functions onto your object while you're in the constructor, that makes any variables local to the constructor available only via said public method, effectively capturing them in the closure created by the inner function. After the constructor dies, its environment is kept alive by any of those functions and it acts exactly like private instance variables in your other common OO languages.

There are no comments on this comment yet.