From 7b0be24ffd0d8b9e3af98ee8f08ffc67ee3d7e7b Mon Sep 17 00:00:00 2001 From: Jason Kao Date: Wed, 7 Nov 2018 20:42:39 -0500 Subject: [PATCH] Small changes in Advanced Functions -> Closures --- 1-js/06-advanced-functions/03-closure/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/06-advanced-functions/03-closure/article.md b/1-js/06-advanced-functions/03-closure/article.md index 8b478dab..b50d7ce0 100644 --- a/1-js/06-advanced-functions/03-closure/article.md +++ b/1-js/06-advanced-functions/03-closure/article.md @@ -339,7 +339,7 @@ Here's what's going on in the `makeCounter` example step-by-step, follow it to m ![](lexenv-nested-makecounter-3.png) - Please note that on this step the inner function was created, but not yet called. The code inside `function() { return count++; }` is not running, we're going to return it. + Please note that on this step the inner function was created, but not yet called. The code inside `function() { return count++; }` is not running; we're going to return it soon. 4. As the execution goes on, the call to `makeCounter()` finishes, and the result (the tiny nested function) is assigned to the global variable `counter`: @@ -380,7 +380,7 @@ But if there were no `let name` in `makeWorker()`, then the search would go outs ```smart header="Closures" There is a general programming term "closure", that developers generally should know. -A [closure](https://en.wikipedia.org/wiki/Closure_(computer_programming)) is a function that remembers its outer variables and can access them. In some languages, that's not possible, or a function should be written in a special way to make it happen. But as explained above, in JavaScript all functions are naturally closures (there is only one exclusion, to be covered in ). +A [closure](https://en.wikipedia.org/wiki/Closure_(computer_programming)) is a function that remembers its outer variables and can access them. In some languages, that's not possible, or a function should be written in a special way to make it happen. But as explained above, in JavaScript, all functions are naturally closures (there is only one exclusion, to be covered in ). That is: they automatically remember where they were created using a hidden `[[Environment]]` property, and all of them can access outer variables.