method

Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    return this;
};

Array.method('unshift',function(){
    this.splice.apply(this,[0,0].concat(Array.prototype.slice.apply(arguments)));
    return this.length;
    
});

posted @ 2014-06-11 16:30  丁元新  阅读(194)  评论(0编辑  收藏  举报
Top