Invoking a function and Javascript

Can a function call with certain arguments be assigned to a variable that can be used later in another function?
Thank you.

once you call a function and assign the output to a variable, you can do what you want with the output value

you can also call a function inside an other function

1 Like

And if i can call a function inside another function, how would that be useful?because i can use the variable wich that previous function is assigned to, into another function.
Or do you mean that the invoke of the next function will execute a call of an old function if it was embedded in it?
Hypothetically like this:

function firstFunc (){
Console.log(“Bla bla”);
}
function secondFunc(){
Var myVar = firstFunc();
Return myVar;
}
fecondFunc(); //now is this call gonna execute firstFunc() wich was embedded in it?

when executing meets a function call, the function is going to execute and return a value, indipendently by what’s around it

so, yes, in that case calling secondFunction also firstFunction called inside it will execute at one point

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.