I have this function in my object:
var time = {
warps : 3,
warpCounter : 50,
warp : function(){
if (this.warps > 0){
this.warps--;
this.warpLoop = 50;
this.warpLoop();
}
},
warpLoop : function(){
setTimeout(function () {
this.increment();
if (warpCounter--){
this.warpLoop();
}else{
if(this.warps > 0){
htmlInteraction.enableButton('warp-button');
}
}
}, 100);
},
};
When I try and call it from another method (using this.warpLoop()
) I get:
Uncaught TypeError: Property 'warpLoop' of object #<Object> is not a function
Why is this?