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/99-js-misc/03-currying-partials/article.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
@@ -17,7 +17,7 @@ Vom crea o funcție ajutătoare `curry(f)` care realizează currying pentru o fu
17
17
18
18
```js run
19
19
*!*
20
-
functioncurry(f) { // curry(f) does the currying transform
20
+
functioncurry(f) { // curry(f) face transformarea currying
21
21
returnfunction(a) {
22
22
returnfunction(b) {
23
23
returnf(a, b);
@@ -26,7 +26,7 @@ function curry(f) { // curry(f) does the currying transform
26
26
}
27
27
*/!*
28
28
29
-
//usage
29
+
//utilizare
30
30
functionsum(a, b) {
31
31
return a + b;
32
32
}
@@ -36,11 +36,11 @@ let curriedSum = curry(sum);
36
36
alert( curriedSum(1)(2) ); // 3
37
37
```
38
38
39
-
As you can see, the implementation is straightforward: it's just two wrappers.
39
+
După cum puteți vedea, implementarea este directă: este vorba doar de două wrappere.
40
40
41
-
-The result of `curry(func)`is a wrapper `function(a)`.
42
-
-When it is called like `curriedSum(1)`, the argument is saved in the Lexical Environment, and a new wrapper is returned`function(b)`.
43
-
-Then this wrapper is called with`2`as an argument, and it passes the call to the original `sum`.
41
+
-Rezultatul lui `curry(func)`este un wrapper `function(a)`.
42
+
-Atunci când este apelat ca `currySum(1)`, argumentul este salvat în mediul lexical și se returnează un nou wrapper `function(b)`.
43
+
-Apoi, acest wrapper este apelat cu`2`ca argument, iar apelul este transmis către `sum` original.
44
44
45
45
More advanced implementations of currying, such as [_.curry](https://lodash.com/docs#curry) from lodash library, return a wrapper that allows a function to be called both normally and partially:
0 commit comments