Skip to content

Commit e54a1c5

Browse files
committed
translated task 2
1 parent 0519773 commit e54a1c5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
The answer is: **Pete**.
1+
Răspunsul este: **Pete**.
22

3-
The `work()` function in the code below gets `name` from the place of its origin through the outer lexical environment reference:
3+
Funcția `work()` din codul de mai jos obține `name` din locul de origine prin intermediul referinței mediului lexical extern:
44

55
![](lexenv-nested-work.svg)
66

7-
So, the result is `"Pete"` here.
7+
Așadar, rezultatul este `"Pete"` aici.
88

9-
But if there were no `let name` in `makeWorker()`, then the search would go outside and take the global variable as we can see from the chain above. In that case the result would be `"John"`.
9+
Dar dacă nu ar exista `let name` în `makeWorker()`, atunci căutarea ar merge în exterior și ar lua variabila globală, așa cum putem vedea din lanțul de mai sus. În acest caz, rezultatul ar fi `"John"`.

1-js/06-advanced-functions/03-closure/2-closure-variable-access/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ importance: 5
22

33
---
44

5-
# Which variables are available?
5+
# Ce variabile sunt disponibile?
66

7-
The function `makeWorker` below makes another function and returns it. That new function can be called from somewhere else.
7+
Funcția `makeWorker` de mai jos creează o altă funcție și o returnează. Această nouă funcție poate fi apelată din altă parte.
88

9-
Will it have access to the outer variables from its creation place, or the invocation place, or both?
9+
Va avea acces la variabilele exterioare de la locul de creare, de la locul de invocare, sau ambele?
1010

1111
```js
1212
function makeWorker() {
@@ -19,11 +19,11 @@ function makeWorker() {
1919

2020
let name = "John";
2121

22-
// create a function
22+
// creați o funcție
2323
let work = makeWorker();
2424

25-
// call it
26-
work(); // what will it show?
25+
// apelați-o
26+
work(); // ce va arăta?
2727
```
2828

29-
Which value it will show? "Pete" or "John"?
29+
Ce valoare va arăta? "Pete" sau "John"?

0 commit comments

Comments
 (0)