• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Coding with Classes and Libra... > Creating Your Own JavaScript Objects

Creating Your Own JavaScript Objects

You can go only so far using other people’s code—the real power of JavaScript isn’t apparent until you begin creating your own JavaScript objects. The following section—after a brief discussion of object-oriented programming—describes defining objects, passing arguments, and creating properties and methods.

NOTE

Traditional object-oriented programming languages, such as C++ or Java, have a concept called a class. Classes define the information that an object contains using member variables, which hold data, and the behavior of how the object works using functions called member methods. JavaScript, however, does not contain the formal notion of a class, but approximates its functionality through the use of what are called prototypes. A prototype defines a JavaScript object’s initial methods and properties when the object is first created by a script.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint