ВИ
Size: a a a
ВИ
ВИ
D
async/await
нужно писать then...catch
𝐓
j
const promisify = (func, ...args) => {
return new Promise((resolve, reject) => {
func(...args, (err, value) => {
if (err) {
reject(err)
} else {
resolve(value)
}
})
})
}
promisify(getPosts)
.then((articles) => Promise.all(articles.map((article) => promisify(getComments, article.id))))
.then(console.log)
.catch(console.error)
DN
j
IS
BC
IS
BC
BC
IS
DN
BC
j
console.log(JSON.stringify(fetchedVideo.tips))
IS
IS