I am having a JavaScript namespace say
A={
CA: function() {
this.B();
},
B: function() {
var test=\'test\';
var result=\'t1\';
C: functi
You have to be careful when you use this to identify anything in Javascript because each time you change scope "this" changes.
Assigning the 'this' reference to it's own variable helps get around this.
var a = new function() {
var self = this;
self.method = function() { alert('hiya'); };
var b = function() {
this.method(); // this isn't 'a' anymore?
self.method(); // but 'self' is still referring to 'a'
};
};