When calling a function within another function
function1(){
return this.a
}
function2(){
return this.b
}
To output in string format, you can call function1 inside 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 values of both functions