JS: Pro JS Design Patterns Sample Code