How do I apply the context of functions to any javascript object? So I can change what "this" means in the functions.
For Example:
var foo = {
a: function() {
alert(this.a);
},
b: function() {
this.b +=1;
alert (this.b);
}
var moo = new Something(); // some object
var moo.func.foo = foo; // right now this is moo.func
// how do I apply/change the context of the foo functions to moo?
// so this should equal moo
moo.a(); // this should work