I am trying to get a recursion method to work in a class context. Within my class I have the following method:
countChildren(n, levelWidth, level) {
the variable this
Gets redefined within:
I agree with krillgar with the declaration of self. it fixed my problem with an asynchronous call.
obj.prototype.foo = function (string){
var self = this;
if(string){ do something }
else
setTimeout(function(){
self.foo("string");
}, 5000);
}