Object Oriented JavaScript Tutorial

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();