I don't quite understand why the following code doesn't work. Is this some kind of restriction on the call function? The browser I'm using to run this code is Mozilla Firefox.
"use strict";
var object = {
foo : "test",
m : function() {
console.log(this.foo);
}
};
var bar = object.m.call;
bar(object); // TypeError: Function.prototype.call called on incompatible undefined
That was just an example to address a bigger, real-world issue. Consider the following:
setInterval(object.m.call, 2000, object);
I'd say, to me, this very much sounds like quite a logical way to do it, but obviously that statement is not going to work because of that TypeError.