Javascript state encapsulation (without classes!)
An example of how you can encapsulate state (and even make it private) with just plain functions and object literals. No prototypes, new
, or this
!
There are also tests for everything (i.e. 100% coverage, just for fun).