If I pass a function as an argument, and the function is a jQuery method, will calling the passed function later still correctly set this
? I thought it would, but calling the function later has this = Window
.
Example code:
var $input = $('input').first();
var evaluators = [];
evaluators.push($input.val);
_.forEach(evaluators, function(valueMethod) {
return valueMethod() //returns undefined always since this = window
}).