我试图更改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
});
'this'将永远是一个数字。 – Krishna 2015-02-05 15:05:48