I've got a child Javascript object
var child = {
foo: function() {
console.log('bar');
}
};
and a parent object
var parent = {
baz: function() {
this.foo();
}
};
merged with jQuery
$.extend(child, parent);
I guess why this works
child.baz();
// prints 'bar'
and this does not
$('#btn').click(child.baz);
// Uncaught TypeError: this.foo is not a function
Thank you