Examples of state encapsulation in Javascript
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!
new
this
There are also tests for everything (i.e. 100% coverage, just for fun).
adrianmcli
Back