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 () {
  //console.log(self)
  //console.log(fn)
        try{
   var returnValue1 = self(arguments[0]);
   }catch(e){}
  try{
   var returnValue2 = fn(arguments[0]);
   }catch(e){}

        return returnValue1 && returnValue2;
    };
};

1 comment:

  1. CASINO HOTEL & CASINO (WYNN) - KTNV
    WYNN RESORTS 전라북도 출장마사지 LTD. (KTNV) 강릉 출장안마 – AUSTIN (KTNV) – The Casino 목포 출장마사지 Hotel and 고양 출장마사지 Casino in WYNN, 안성 출장마사지 as well as the WYNN Casino in Las Vegas,

    ReplyDelete