Skip to content

Commit 3805da6

Browse files
committed
translated article.md
1 parent 90397f7 commit 3805da6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

1-js/11-async/08-async-await/article.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,18 @@ let results = await Promise.all([
294294

295295
````
296296
297-
## Summary
297+
## Sumar
298298
299-
The `async` keyword before a function has two effects:
299+
Cuvântul cheie `async` înaintea unei funcții are două efecte:
300300
301-
1. Makes it always return a promise.
302-
2. Allows `await` to be used in it.
301+
1. Face ca aceasta să returneze întotdeauna o promisiune.
302+
2. Permite ca `await` să fie folosit în ea.
303303
304-
The `await` keyword before a promise makes JavaScript wait until that promise settles, and then:
304+
Cuvântul cheie `await` înaintea unei promisiuni face ca JavaScript să aștepte până când promisiunea respectivă se soluționează, iar apoi:
305305
306-
1. If it's an error, an exception is generatedsame as if `throw error` were called at that very place.
307-
2. Otherwise, it returns the result.
306+
1. Dacă este o eroare, se generează o excepțiela fel ca și cum `throw error` ar fi fost apelat chiar în acel loc.
307+
2. În caz contrar, se returnează rezultatul.
308308
309-
Together they provide a great framework to write asynchronous code that is easy to both read and write.
309+
Împreună acestea oferă un cadru excelent pentru a scrie cod asincron care este ușor de citit și de scris.
310310
311-
With `async/await` we rarely need to write `promise.then/catch`, but we still shouldn't forget that they are based on promises, because sometimes (e.g. in the outermost scope) we have to use these methods. Also `Promise.all` is nice when we are waiting for many tasks simultaneously.
311+
Cu `async/await` avem rareori nevoie să scriem `promise.then/catch`, dar tot nu trebuie să uităm că acestea se bazează pe promisiuni, deoarece uneori (e.g. în domeniul de aplicare cel mai îndepărtat) trebuie să folosim aceste metode. De asemenea `Promise.all` este util atunci când așteptăm mai multe sarcini simultan.

0 commit comments

Comments
 (0)