News
A function scope is in a way also a block scope, so let and constwould behave the same way they did in our previous examples. However, function scopes also encapsulate variables declared with var .
When a new function scope is declared, the variables in the surrounding context are made available to it. This is a simple idea—don’t let the fancy name fool you.
That returned function, which we assign to the variable log, can still access the context argument because it was in scope where the function was defined. Fun fact: Referencing context is made ...
i.e. intuitively it looks like the variable will only be available within the block but it is accessible outside the block .. in javascript's case, because var doesn't make a block level ...
Results that may be inaccessible to you are currently showing.
Hide inaccessible results