Exploring design patterns in JavaScript