You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A function gets outer variables as they are now, it uses the most recent values.
3
+
O funcție primește variabilele exterioare așa cum sunt ele acum, folosește cele mai recente valori.
4
4
5
-
Old variable values are not saved anywhere. When a function wants a variable, it takes the current value from its own Lexical Environment or the outer one.
5
+
Valorile vechi ale variabilelor nu sunt salvate nicăieri. Atunci când o funcție dorește o variabilă, aceasta ia valoarea curentă din propriul mediu lexical sau din cel extern.
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/03-closure/1-closure-latest-changes/task.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,22 @@ importance: 5
2
2
3
3
---
4
4
5
-
# Does a function pickup latest changes?
5
+
# Preia o funcție ultimele modificări?
6
6
7
-
The function sayHi uses an external variable name. When the function runs, which value is it going to use?
7
+
Funcția sayHi folosește un nume de variabilă externă. Când funcția se execută, ce valoare va folosi?
8
8
9
9
```js
10
10
let name ="John";
11
11
12
12
functionsayHi() {
13
-
alert("Hi, "+ name);
13
+
alert("Salut, "+ name);
14
14
}
15
15
16
16
name ="Pete";
17
17
18
-
sayHi(); //what will it show: "John" or "Pete"?
18
+
sayHi(); //ce va afișa: "John" sau "Pete"?
19
19
```
20
20
21
-
Such situations are common both in browser and server-side development. A function may be scheduled to execute later than it is created, for instance after a user action or a network request.
21
+
Astfel de situații sunt frecvente atât în browser cât și în dezvoltarea pe partea de server. O funcție poate fi programată pentru a fi executată mai târziu decât este creată, de exemplu după o acțiune a utilizatorului sau după o cerere de rețea.
22
22
23
-
So, the question is: does it pick up the latest changes?
23
+
Așadar, întrebarea este: preia cele mai recente modificări?
0 commit comments