Suppose I have the following classes Test1 and Test2. Test1 declares two functions, fA and fB, and fA is called inside fB. Test2 declares fA inside fB. Would either of them have a performance advantage over the other? Assume that fA is recursive and will be called once every time fB is called.
Example:
function Test1() {
this.fA = function() {
//function body here...
};
this.fB = function() {
//some code...
this.fA();
};
};
function Test2() {
this.fB = function() {
let fA = function() {
//function body here...
};
//some code...
fA();
};
};