I\'m new to JS (from C++/etc), and it\'s just occurred to me that closures seem to be a simpler and more convenient way to handle encapsulation than classes. This code seems to
The benefit of a function for the purposes of encapsulating functionality is that you can use the module pattern:
http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
The module pattern provides the capability of creating private members and methods, without something with a lot of overhead like ease.js:
http://easejs.org/