3. Promises, yield, generator and async functions #6
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Promises, async functions etc.to Promises, yield, generator and async functionsPromises, yield, generator and async functionsto 3. Promises, yield, generator and async functionsasync/await = async makes a function return a promise.
await makes an async function wait for a promise.
By using these 2 keywords together, they allow you to write asynchronous code in a synchronous manner.
async doesn't have resolve and reject parameters. Everything after await is placed in an event queue.
async is works together with await.
Promise = an Object that manages asynchronous operations.
Wrap a promise object around {asynchronous code}
"I promise to return a value"
PENDING -> RESOLVED or REJECTED
new Promise ((resolve, reject) => {async code} ) (it is usually an arrow function)