104
rated 0 times
[
108]
[
4]
/ answers: 1 / hits: 23458
/ 12 Years ago, wed, september 5, 2012, 12:00:00
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?
More From » node.js