From f24a6e577bc43f7c85d68361cdfcd8f73e7bccc1 Mon Sep 17 00:00:00 2001 From: jamesblckwell <47798588+jamesblckwell@users.noreply.github.com> Date: Mon, 7 Oct 2019 12:05:39 +0100 Subject: [PATCH] Fixed typo on line 366 "Now when the call looks for `count` variable, it first searches its own Lexical Environment (empty), then the Lexical Environment of the outer `makeCounter()` call, where finds it." to "Now when the call looks for `count` variable, it first searches its own Lexical Environment (empty), then the Lexical Environment of the outer `makeCounter()` call, where it finds it." --- 1-js/06-advanced-functions/03-closure/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/06-advanced-functions/03-closure/article.md b/1-js/06-advanced-functions/03-closure/article.md index a39dfc95..0dc3b715 100644 --- a/1-js/06-advanced-functions/03-closure/article.md +++ b/1-js/06-advanced-functions/03-closure/article.md @@ -363,7 +363,7 @@ Please note the additional `[[Environment]]` property is covered here. We didn't ![](lexenv-nested-makecounter-5.svg) - Now when the call looks for `count` variable, it first searches its own Lexical Environment (empty), then the Lexical Environment of the outer `makeCounter()` call, where finds it. + Now when the call looks for `count` variable, it first searches its own Lexical Environment (empty), then the Lexical Environment of the outer `makeCounter()` call, where it finds it. Please note how memory management works here. Although `makeCounter()` call finished some time ago, its Lexical Environment was retained in memory, because there's a nested function with `[[Environment]]` referencing it.