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
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/01-recursion/article.md
+30-30Lines changed: 30 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,39 +100,39 @@ Profunzimea maximă de recursivitate este limitată de motorul JavaScript. Ne pu
100
100
101
101
Acest lucru limitează aplicarea recursivității, dar aceasta rămâne totuși foarte largă. Există multe sarcini în care modul recursiv de gândire oferă un cod mai simplu, mai ușor de întreținut.
102
102
103
-
## The execution context and stack
103
+
## Execution context și stack
104
104
105
-
Now let's examine how recursive calls work. For that we'll look under the hood of functions.
105
+
Acum să examinăm modul în care funcționează apelurile recursive. Pentru aceasta ne vom uita sub capota funcțiilor.
106
106
107
-
The information about the processof execution of a running function is stored in its *execution context*.
107
+
Informațiile despre procesul de execuție a unei funcții în curs de execuție sunt stocate în*execution context* al acesteia.
108
108
109
-
The [execution context](https://tc39.github.io/ecma262/#sec-execution-contexts) is an internal data structure that contains details about the execution of a function: where the control flow is now, the current variables, the value of `this` (we don't use it here) and few other internal details.
109
+
[Execution context](https://tc39.github.io/ecma262/#sec-execution-contexts) este o structură internă de date care conține detalii despre execuția unei funcții: unde se află acum fluxul de control, variabilele curente, valoarea lui `this` (nu o folosim aici) și alte câteva detalii interne.
110
110
111
-
Onefunction call has exactly one execution context associated with it.
111
+
Un apel de funcție are asociat exact un context de execuție.
112
112
113
-
When a function makes a nested call, the following happens:
113
+
Atunci când o funcție face un apel nested, se întâmplă următoarele:
114
114
115
-
- The current function is paused.
116
-
- The execution context associated with it is remembered in a special data structure called *execution context stack*.
117
-
- The nested call executes.
118
-
- After it ends, the old execution context is retrieved from the stack, and the outer function is resumed from where it stopped.
115
+
-Funcția curentă este pusă pe pauză.
116
+
-Contextul de execuție asociat acesteia este reținut într-o structură de date specială numită*execution context stack*.
117
+
-Se execută apelul nested.
118
+
-După ce se termină, vechiul context de execuție este regăsit din stack, iar funcția exterioară este reluată de unde s-a oprit.
119
119
120
-
Let's see what happens during the `pow(2, 3)` call.
120
+
Să vedem ce se întâmplă în timpul apelului `pow(2, 3)`.
121
121
122
122
### pow(2, 3)
123
123
124
-
In the beginning of the call `pow(2, 3)` the execution context will store variables: `x = 2, n = 3`, the execution flow is at line `1` of the function.
124
+
La începutul apelului `pow(2, 3)`contextul de execuție va stoca variabilele:`x = 2, n = 3`, fluxul de execuție se află la linia `1`a funcției.
125
125
126
-
We can sketch it as:
126
+
Îl putem schița precum:
127
127
128
128
<ul class="function-execution-context-list">
129
129
<li>
130
-
<span class="function-execution-context">Context: { x:2, n:3, at line1 }</span>
130
+
<span class="function-execution-context">Context: { x:2, n:3, la linia1 }</span>
The new current execution context is on top (and bold), and previous remembered contexts are below.
186
+
Noul context de execuție curent este în partea de sus (cu caractere îngroșate), iar contextele memorate anterior sunt mai jos.
187
187
188
-
When we finish the subcall -- it is easy to resume the previous context, because it keeps both variables and the exact place of the code where it stopped.
188
+
Când terminăm subapelul --este ușor să reluăm contextul anterior, deoarece acesta păstrează atât variabilele cât și locul exact al codului în care s-a oprit.
189
189
190
190
```smart
191
-
Here in the picture we use the word "line", as in our example there'sonlyonesubcallinline, butgenerallyasinglelineofcodemaycontainmultiplesubcalls, like`pow(…) + pow(…) + somethingElse(…)`.
191
+
Aici în imagine folosim cuvântul "linie", deoarece în exemplul nostru există un singur subapel în linie, dar în general o singură linie de cod poate conține mai multe subapelări, cum ar fi `pow(...) +pow(...) +somethingElse(…)`.
192
192
193
-
Soitwouldbemoreprecisetosaythattheexecutionresumes"immediately after the subcall".
193
+
Deci ar fi mai precis să spunem că execuția se reia "imediat după subapelare".
0 commit comments