Define a method after object instantiation
|
|
It is possible to define a method for a type of object after the object has already been instantiated. |
var o = new Object;
Object.prototype.sayHi = function () { alert("hi"); };
o.sayHi();
|
|
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
|