I've been diving into the "You Don't Know JS" book series and came across a confusing piece of code. While looking at the following code snippet, I noticed that when I tried running it, nothing was printed out. Despite having "foo()" inside the function bar, foo is not invoked. Can anyone shed some light on why the second foo() is not being called during bar execution?
What exactly happens when the code reaches the line "foo()"? Any insight would be greatly appreciated.
function foo() {
console.log( "5" );
}
function bar() {
var a = 3;
foo();
}