I am trying to understand the flow of the following code snippet -
var inner = function (a){
console.log("a is -- ", 9);
}
var outer = function(b){
console.log("Executing outer()");
b();
}
outer(inner(5));
The output currently is -
a is -- 9
Executing outer()
app.js:6 Uncaught TypeError: b is not a function
at outer (app.js:6)
at app.js:9
I am expecting the following -
Executing outer()
a is -- 9
I understand that in the statement outer(inner(9)) : inner(9) is a function call that evaluates (runs the code contained within the inner() function), but i want the code inside the outer() function to evaluate the code within inner(). Basically, i want to pass 9 as a variable to outer() so that it can pass it to inner()
Please point me to any online resource that will help me understand this concept better. Also, please mark this question as duplicate if already answered. Thanks!