while we calling a function in another function
function1(){
return this.a
}
function2(){
return this.b
}
if we want output in string this method is used
we can recall the function1 in function2
function2(){
var resultOfFunction1 = this.function1();
return resultOfFunction1.toString() + ' ' + this.b.toString();
}
for array
function2() {
var resultOfFunction1 = this.function1(); // Assuming this is a method that returns a value
return [resultOfFunction1, this.b];
}
for object
function2() {
console.log(this.a);
var resultOfFunction1 = this.function1(); // Assuming this is a method that returns a value
return {
valueOfFunction1: resultOfFunction1,
valueOfB: this.b
};
}
we want to return the both function values