I have this nodeJS code.
module.exports = {
foo: function(req, res){
...
this.bar(); // failing
bar(); // failing
...
},
bar: function(){
...
...
}
}
I need to call the bar()
method from inside the foo()
method. I tried this.bar()
as well as bar()
, but both fail saying TypeError: Object #<Object> has no method 'bar()'
.
How can I call one method from the other?