2015-01-05 10:18:42 +11:00

12 lines
311 B
JavaScript

function call(fn, context=this) {
return fn.call(context);
}
var context = {a: 99};
// use the default parameter
assert.strictEqual(call.call(context, function(){ return this.a; }), 99);
// explicitly provide the default parameter value
assert.strictEqual(call(function(){ return this.a; }, context), 99);