There are several ways to do this.
1) Help window outside
var self = this; $.each.call(this, [1,2,3], function(){ console.log(self);
2) Bind a function to a specific area
$.each.call(this, [1,2,3], function(){ console.log(this);
3) Use the function with the ES6 arrow, which binds to the current context (cannot be used in most browsers without conversion 6-> 5)
$.each.call(this, [1,2,3], () => { console.log(this); // expecting to see the window object });
4) Direct help window only
$.each.call(this, [1,2,3], () => { console.log(window); // expecting to see the window object });
source share