As I have already mentioned, there are many different ways to approach object-oriented programming with JavaScript. You can create objects or pseudo-objects with any of the following:
Each of these methods for creating objects or pseudo-objects in JavaScript is valid, yet some are more flexible than others. This does not mean that these methods are not usefulthere are definitely situations where a particular method would be better than all the other approaches. Let's take a brief look at each of these approaches and what situations they would be useful in. Note Since this chapter will be focusing in-depth on object constructors and prototypes, we will not cover these two methods in this section. |