|
|
|
|
|
by doomslice
5004 days ago
|
|
As you suggest, there are several schools of thought about how best to provide class-style programming. By using a closure instead of prototypes, you can have "true" private properties and functions. If you use prototype, you'll need to use a convention to mark something as private and hope the developers respect that (marking it with an underscore is common). In my experience, someone will ignore the convention and then something will break when you change or remove your "private" variable. |
|