async function run () {
const user = await getUser()
const tweets = await getTweets(user)
return [user, tweets]
}
async
functions are another way to use functions.
See: Async Function
async function run () {
const user = await getUser()
const tweets = await getTweets(user)
return [user, tweets]
}
async
functions are another way to use functions.
See: Async Function
Promise.all(···)
Promise.race(···)
Promise.reject(···)
Promise.resolve(···)
promise
.then((result) => { ··· })
.catch((error) => { ··· })
.finally(() => {
/\*logic independent of success/error \*/
})
The handler is called when the promise is fulfilled or rejected
promise
.then((result) => { ··· })
.catch((error) => { ··· })
new Promise((resolve, reject) => {
if (ok) { resolve(result) }
else { reject(error) }
})
for asynchronous programming. See: Promises