Mark As Completed Discussion

Functions inside functions

This is a very important concept to understand for fully understanding closures. Take a look at the example code below. It has a method called scopeCheck() inside which there is another function called innerScopeCheck(). Outside the function, there is a variable called globalScope, another variable that gets the return value of the scopeCheck() method and a couple of console.log() statements.

JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment