This is a popular way to add methods to Function. I don't use it in these code samples.

Results

Function.prototype.twice = function() {
    var fn = this;
    return function() {
        return fn.call(this, fn.apply(this, arguments));
    };
}
function plus1(x) { return x+1; } var plus2 = plus1.twice(); log(plus2(10));