Javascript Patterns with examples