function Test(){
this.update = function(entity){
entity.forEach(function(enemy) {
this.checkHit(enemy);
});
}
this.checkHit = function(entity){
console.log("worked!");
}
}
How can I call Test's this.checkHit function, and pass it the current value in the entity's foreach loop?
Current code gives "this.checkHit" is not a function.
var that = this;..........console.log(this)and do changes as suggested by @zerkms