Adding and Deleting Object Own Methods
This section provides a quick description of object's own methods. A tutorial example is provided on how to add, call, and delete object's own methods.
When you create a new object from the "Object" constructor, you will get an object with only some default methods:
But you can add more methods to one object at any time using an assignment operation like this:
object_name.method_name = function_name;
The added method is for this one object only. Other objects will not have this method.
Calling a method on an object is the same as calling the assigned function as shown below:
object_name.method_name(param1, param2, ...);
You can also delete methods from one object at any time using a delete operation like this:
Here is a tutorial example that shows you how to add a new method, call a method, and delete a method.
Table of Contents