I am not exactly sure the differences between saying "function x(){}" or "this.x=function(){}", but I had to make an object oriented JavaScript which is laid out like this:
function PROJECT(){
...
...
...
this.main_call=function(...){ return this.recursive_call(...); }
this.recursive_call=function(...){
...
var local,variables;
function helper(...,ref){
...
ref.recursive_call(...);
}
...
helper(...,this);
...
}
}
x=new PROJECT();
x.main_call(input);
My question here is whether this is good style or if there is some way I can call the helper function (which is used to stop duplicating the same code over and over), without passing a "this" pointer. I am a bit concerned because helper function already accesses all the local variables in recursive_call, but it throws errors if I try to access this.recursive_call directly. I also ran into problems with variables overriding when trying to declare this.helper=function(...){...}.