Is it possible to set a default function on an object, such that when I call myObj()
that function is executed? Let's say I have the following func
object
function func(_func) {
this._func = _func;
this.call = function() {
alert("called a function");
this._func();
}
}
var test = new func(function() {
// do something
});
test.call();
I'd like to replace test.call()
with simply test()
. Is that possible?