JS: how to call a public method that is defined like this: this.name = function(){return 2;}
- by Totty
var CoreGroups = new function(){
this.name = function(){return 'name test'};
var functionName = function(){
// here I want to call the name() function
a = this.name(); // doesnt work: this.name is not a function
b = name(); // doesn't work too: name is not defined
}
}
Any idea on how to call the name() function from the functionName() function?
Thanks! ;)