Pro JavaScript Design Patterns

JavaScript is one of the most popular and widely used languages in the world today. Because it is embedded in all modern browsers, it has an extraordinarily wide distribution. As a language, it is incredibly important in our daily lives, powering the websites that we go to and helping the Web to present a rich interface.

Why then do some still consider it to be a toy language, not worthy of the professional programmer? We think it is because people do not realize the full power of the language and how unique it is in the programming world today. JavaScript is a very expressive language, with some features that are uncommon to the C family of languages.

In this chapter we explore some of the features that make JavaScript so expressive. We look at how the language allows you to accomplish the same task in a number of different ways and how you can take alternative approaches to object-oriented programming by using concepts from functional programming. We discuss why you should use design patterns in the first place and how adapting them to JavaScript will make your code more efficient and easie to work with.