Skip to content

Commit 97cd2fc

Browse files
authored
function declaration vs function call conflict
function() { return count++; } is running because it is a function declaration. It is running and result of this running a function has been created and sent as a parameter to return command. "return count++;" this part is not running because the function has not been called yet.
1 parent 7510263 commit 97cd2fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1-js/06-advanced-functions/03-closure/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Please note the additional `[[Environment]]` property is covered here. We didn't
351351

352352
![](lexenv-nested-makecounter-3.svg)
353353

354-
Please note that on this step the inner function was created, but not yet called. The code inside `function() { return count++; }` is not running.
354+
Please note that on this step the inner function was created, but not yet called. The code inside `return count++;` is not running.
355355

356356
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`:
357357

0 commit comments

Comments
 (0)