WHAT’S IN THIS CHAPTER?
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code downloads for this chapter are found at
Object.create method introduced in ECMAScript 5 is a factory built into the language. You have also met many factories in this book, although under other names. For example, a module technically meets the definition in that its purpose is to create and return an object, albeit with some data-hiding in the bargain.
Why would you want to use a factory to create an object instead of
new or an ordinary function call? Broadly speaking, there are two reasons: increased control and increased abstraction. In this chapter, you will work with an example that illustrates both.
There are two kinds of presentations: regular presentations and presentations by vendors. The basic presentation has a title and an optional presenter. (Sometimes a presentation ...