various examples of js design patterns