[Solved] I would like to ask how to explain this (javascript function)
I believe it should be because of lexical scoping or static scoping along with function scoping. lexical scoping says variable scope is dependent on when the function was created in your cases when function b was created num was scoped to global. function b() { console.log(num)//num is scoped to its parent function it was created … Read more