Im trying to call a function/Method in javscript using OOP style but from a different context.
for example:
var SomeClass = function(){
this.init = function(){
var something = "An Interesting Variable";
this.foo(something); //this works fine
},
this.foo = function(bar){
alert(bar);
}
this.foo2 = function(){
this.foo(something); // this deos not work/ something is not defined
}
};
var newClass = new SomeClass();
newClass.init();
newClass.foo2();
so basically i want to call this.foo() function within the this.foo2() context, but acting as the this.init(), im not sure this makes sense, but im new to OOP in javascript.