I have this simple Javascript object that calls its own prototype method in one of its local methods. [SEE MY EDIT]
var Obj = function() {
function inner() {
this.exported();
}
this.exported = function() {
alert("yay!");
};
};
var test = new Obj();
Obj.exported();
However, I get the error TypeError: Object function() {...} has no method 'exported'
.
Any idea how this should be done?
EDIT: whoops, just realized I never called inner(), but thanks Patrick for answering that part anyways. Here is a better example
var Obj = function() {
this.exported = function() {
inner();
};
function inner() {
this.yay();
}
this.yay = function() {
alert("yay!");
};
};
var test = new Obj();
test.exported();
I get TypeError: Object [object global] has no method 'exported'