Is it possible to do something like this in Javascript:
var myFunction = function() {
return true;
};
var anotherFunction = function () {
return false;
};
$(function () {
this.myFunction = anotherFunction;
myFunction(); // to return false
});
Fiddle
My intuition says yes, but it doesn't work. How can I achieve this functionality?