Mark As Completed Discussion

By definition, a JavaScript closure ensures that the variable is a combination of a function along with references to its surrounding state. To understand this a little more clearly, we will make use of the Inspect command in Google Chrome. The below code snippet is a slight modification of the previous one.

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