What is the difference between functions inside an object. I have 2 examples that basically do the same thing.
function a(param) {
function b(input) {
return input%10;
};
return 'The result is ' + b(param);
};
and
function a(param) {
this.b=function(input) {
return input%10;
};
return 'The result is ' + this.b(param);
};
What are the advantages and disadvantages in both cases? In the second, I know that this function can be called from outside the main function. Is there any difference at startup? (e.g. time and performance)
source
share