Next, observe that the constructor is being passed three parameters. These parameters will be containing the starting values when an object is created. There is a major difference between the terms: created and defined. By definition, I mean the structure / methods of the class of objects. And by creation I mean a specific object. An example will help here. Consider the class of Person. Its definition will include things like his / her name, age, email, etc. Every instance of Person will share this structure. But the information contained in these properties will be different for different instances of Person. Once an object is defined we can create several instances of it. For example, "Tom Cruise, 30, tom@aol.com" and "Mustafa Qureshi, 65, qureshi@cyber.net.pk" are two instances of the Person object.
The copyright of the article
Creating Custom Objects in
JavaScript is owned by Muhammad Ali Shah. Permission to republish
Creating Custom Objects in print or online must be granted by the author in writing.