Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
async function saveData(data) {
for(let id of Object.keys(data)) {
await appendFile(fileName, id);
await appendFile(fileName, data[id]);
}
}
saveData({cat:1,dog:2})
let data = {cat:1,dog:2};
Object.keys(data).reduce(
(p, id) => p
.then(() => appendFile(fileName, id))
.then(() => appendFile(fileName, data[id])),
Promise.resolve()
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question