In the example below I'm trying to access the parents sibling. Is there a better way than what I've come up with, what gives?
Broken:
var funkyness = function(){
var some_obj = {
foo: function() {
alert('bar');
},
'wrapper' : {
'OK': function() {
// I want to access some_obj.foo
foo(); // foo is not defined
}
}
}
some_obj.wrapper.OK();
};
Seems like a hack fix:
var funkyness = function(){
var afoo;
var some_obj = {
foo: function() {
alert('bar');
},
'wrapper' : {
'OK': function() {
// I want to access some_obj.foo
afoo();
}
}
}
afoo = some_obj.foo;
some_obj.wrapper.OK();
};