Reputation: 12438
I have been using JS Modular pattern throughout the application. The modules look like the following:
var moduleName = {
prop1 : 'value1',
prop2 : 'value2',
fun1Name : function () {
// body of funName
moduleName.fun2Name(); // notice the way I am calling the function using moduleName
// Didn't use this.fun2Name()
},
fun2Name : function () {
// body of functName
}
};
And inside the modules, I have been accessing the functions using moduleName.functionName()
which may also be accessed (as we all know) using this.functionName()
. Now I am refactoring the code and I was just curious to know that:
moduleName.functionName()
to this.functionName()
wherever possible?Upvotes: 0
Views: 38
Reputation: 943216
Upvotes: 1