SOURCE

Function.prototype.call2 = function(context) {
    var context = context || window;
    context.fn = this;

    var args = [];
    for(var i = 1; i < arguments.length; i+= 1) {
        args.push('arguments[' + i + ']');
    }

    var result = eval('context.fn(' + args + ')');
    delete context.fn;
    return result;
}

var foo = {value: 100};
var bar1 = function() {
    console.log(this.value);
}
var bar2 = function(arg1, arg2) {
    console.log(this.value + arg1 + arg2);
}

bar1.call(foo); // Expect: 100
bar2.call(foo, 200, 300); // Expect: 600

bar1.call2(foo); // Expect: 100
bar2.call2(foo, 200, 300); // Expect: 600
console 命令行工具 X clear

                    
>
console