Friday, 9 December 2011

js extend method

this is what you need to use if you want to extend a function in js. Easy to use :).

// to use only for alert
Function.prototype.extend = function (fn) {
    var self = this;
 return function () {
   var returnValue1 = self(arguments[0]);
   var returnValue2 = fn(arguments[0]);

        return returnValue1 && returnValue2;

No comments:

Post a Comment