我试图为jQuery的$.each
方法改变上下文。我错过了什么?
$.each.call(this, [1,2,3], function(){
console.log(this); // expecting to see the window object
});
var foo = { bar: 1 };
$.each.call(foo, [1,2,3], function(){
console.log(this); // expecting to see the foo object
});