I'm experimenting with higher-order functions in Javascript and I wrote up something like this:
function hof (setter) {
setter("not test");
}
function hof2 (setter) {
setter.call(window.jQuery, "not test 2");
}
var span = $("#myTest").text;
hof(span);
hof2(span);
Here's the jsFiddle version: http://jsfiddle.net/6mcYt/
However, both functions throw an error. What is the best way to pass jQuery setter functions to a higher-order function?