Written by
Richa
on
on
Requirements when creating a User Defined objects
While creating a user-defined objects there are two steps which are required:
- Defining the object type by writing a function.
- Creating an object with ‘new’ keyword.
To define an object type we have to create a function for the object type that focus on its name and properties.
The ‘new’ keyword creates a case of a user-defined object or built-in object that has a constructor function.
Example: