Posts Tagged ‘acc’

Private object members via closures

Sunday, March 1st, 2009

In almost any object oriented language, you can define access levels for variables in objects. You can in JavaScript, too, but it’s not quite as clear cut as adding a “public” or “private” key word to your object definition. Once you understand how closures work, though, it’s pretty obvious how to implement private member properties and methods. (more…)