I have tree of closures: 'A' containing private closures 'pancake' and 'B'. There is a situation when I need to call from inside of 'B' public function, the private closure of 'A' - 'pancake' and retrieve its public properity. How can I do it? Oh, and this is useless, as this is not an object.
My code:
var A = (function() {
var pancake = (function() {
return {
numeric: 142
};
})(A);
var B = (function() {
return {
init: function(name) {
console.log(pancake.numeric);
//How to access the same element using 'name' variable?
}
};
})(A);
return {
init: function() {
B.init('pancake');
}
};
})();
A.init();
JSFiddle might show more details: http://jsfiddle.net/yALkY/3/
Thanks in advance