Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e61bfa2

Browse files
committed
minor fixes
1 parent c48c52c commit e61bfa2

File tree

1 file changed

+3
-3
lines changed
  • 1-js/06-advanced-functions/03-closure/10-make-army

1 file changed

+3
-3
lines changed

‎1-js/06-advanced-functions/03-closure/10-make-army/solution.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Let's examine what exactly happens inside `makeArmy`, and the solution will beco
8888
8989
Here `let j = i` declares an "iteration-local" variable `j` and copies `i` into it. Primitives are copied "by value", so we actually get an independent copy of `i`, belonging to the current loop iteration.
9090
91-
The shooters work correctly, because, the value of `i` now lives a little bit closer. Not in `makeArmy()` Lexical Environment, but in the Lexical Environment that corresponds the current loop iteration:
91+
The shooters work correctly, because the value of `i` now lives a little bit closer. Not in `makeArmy()` Lexical Environment, but in the Lexical Environment that corresponds the current loop iteration:
9292
9393
![](lexenv-makearmy-while-fixed.svg)
9494
@@ -117,11 +117,11 @@ Let's examine what exactly happens inside `makeArmy`, and the solution will beco
117117
army[5](); // 5
118118
```
119119
120-
That's essentially the same, because, `for` on each iteration generates a new lexical environment, with its own variable `i`. So `shooter` generated in every iteration references its own `i`, from that very iteration.
120+
That's essentially the same, because `for` on each iteration generates a new lexical environment, with its own variable `i`. So `shooter` generated in every iteration references its own `i`, from that very iteration.
121121
122122
![](lexenv-makearmy-for-fixed.svg)
123123
124-
Now, as you've put so much effort into reading this, and the final recipe is so simple - just use `for`, you may wonder -\- was it worth that?
124+
Now, as you've put so much effort into reading this, and the final recipe is so simple - just use `for`, you may wonder -- was it worth that?
125125
126126
Well, if you could easily answer the question, you wouldn't read the solution. So, hopefully this task must have helped you to understand things a bit better.
127127

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /