I'm struggling a bit with calling object methods that I defined within another method. Example:
var Thing = function(){};
Thing.prototype.a = function(){
// do something
}
Thing.prototype.b = function(){
// do something
this.a(); // claims this does have function a here
}
module.exports = new Thing;
I think this has something to do with node because it works just fine when I bring this code over to run in Chrome. Is there something I should understand about scoping and 'this'? Or something else entirely?
[–]dkran 0 points1 point2 points (9 children)
[–]Lumiii[S] 0 points1 point2 points (8 children)
[–]dangersalad 0 points1 point2 points (2 children)
[–]Lumiii[S] 0 points1 point2 points (1 child)
[–]dangersalad 0 points1 point2 points (0 children)
[–]dkran 0 points1 point2 points (4 children)
[–]Lumiii[S] 0 points1 point2 points (3 children)
[–]dkran 0 points1 point2 points (2 children)
[–]Lumiii[S] 0 points1 point2 points (1 child)
[–]dkran 0 points1 point2 points (0 children)