I'm wondering how can I access local function in my module.
In calc module :
var calc = {};
calc.add = function(a,b){
return a+b;
};
calc.multi = function(a,b){
return a*b;
};
module.exports = calc;
However If I add some function use a local function like this :
calc.verify = function(a,b){
return (this.add(a,b)) + (this.multi(a,b))
};
This is not working properly. I'd like to use both calc.add and calc.multi function at any time in my module.
What's wrong in my code?
Edit ::
var calc = {};
calc.add = function(a,b){
return a+b;
};
calc.multi = function(a,b){
return a*b;
};
calc.verify = function(a,b){
return (this.add(a,b)) + (this.multi(a,b))
};
module.exports = calc;
thismight not be thecalcobject. Try s/this/calc/verify()? A sample code of that would help.