Add method to Object class
|
|
Since all objects used in JavaScript are inherited from Object, all of the object can use the method added to Object. |
Object.prototype.showValue = function () { alert(this.valueOf()); };
var str = "hello"; var iNum = 25; str.showValue(); iNum.showValue();
|
|
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
-
|