I've been trying to further my understanding of javascript namespacing and prototype inheritance but i am running into an issue.
An example of what i'm dealing with code wise:
var namespace = {
ex1: function () { },
ex2: function () {
this.exvar1 = 0,
this.exvar2 = 0;
}
}
namespace.ex1.prototype = {
method1: function () {
},
method2: function () {
}
};
namespace.ex2.prototype = {
method1: function () {
alert("ex2.method1" + typeof this.method1);
},
method2: function () {
alert("ex2.method2" + typeof this.method2);
}
};
if i then try and call a method by doing:
namespace.ex2.method1();
i find that namespace.ex2.method1 is not a function.
What am i missing?