3. Promises, yield, generator and async functions #6

Open
opened 2025-02-05 11:09:08 +01:00 by lang · 3 comments
Collaborator
No description provided.
lang changed title from Promises, async functions etc. to Promises, yield, generator and async functions 2025-02-05 11:12:17 +01:00
lang changed title from Promises, yield, generator and async functions to 3. Promises, yield, generator and async functions 2025-02-05 11:20:31 +01:00
Author
Collaborator
let hello = 'asdkljfbnas';
```js let hello = 'asdkljfbnas'; ```
Owner

async/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.

async/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.
Owner

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)

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)
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: andi/Practice-1#6
No description provided.