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
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,72 +42,72 @@ După cum puteți vedea, implementarea este directă: este vorba doar de două w
42
42
- Atunci când este apelat ca `currySum(1)`, argumentul este salvat în mediul lexical și se returnează un nou wrapper `function(b)`.
43
43
- Apoi, acest wrapper este apelat cu `2` ca argument, iar apelul este transmis către `sum` original.
44
44
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:
45
+
Implementările mai avansate de currying, cum ar fi [_.curry](https://lodash.com/docs#curry)din biblioteca lodash, returnează un wrapper care permite ca o funcție să fie apelată atât în mod normal, cât și parțial:
46
46
47
47
```js run
48
48
functionsum(a, b) {
49
49
return a + b;
50
50
}
51
51
52
-
let curriedSum =_.curry(sum); //using _.curry from lodash library
52
+
let curriedSum =_.curry(sum); //folosind _.curry din biblioteca lodash
53
53
54
54
alert( curriedSum(1, 2) ); // 3, still callable normally
55
55
alert( curriedSum(1)(2) ); // 3, called partially
56
56
```
57
57
58
-
## Currying? What for?
58
+
## Currying? Pentru ce?
59
59
60
-
To understand the benefits we need a worthy real-life example.
60
+
Pentru a înțelege beneficiile, avem nevoie de un exemplu demn din viața reală.
61
61
62
-
For instance, we have the logging function `log(date, importance, message)`that formats and outputs the information. In real projects such functions have many useful features like sending logs over the network, here we'll just use`alert`:
62
+
De exemplu, avem funcția de logare `log(date, importance, message)`care formatează și produce informații. În proiectele reale astfel de funcții au multe caracteristici utile cum ar fi trimiterea de loguri prin rețea, aici vom folosi doar`alert`:
0 commit comments