I have this code example:
function s () {
this.func = [];
this.func.addF = function (str) {
this.func.push(str);
}
}
When I create an Instance of that object:
var a = new s ();
a.func.addF ("hello");
I get an error saying: Uncaught TypeError: Cannot read property 'push' of undefined.
I can understand that this.func
is undefined at that point, but what should I do to make this work. Pls help.