by pmalynin · 11y ago · 0 comments
Instead of taking a callback, a function returns a promise, which can be daisy-chained to do work.
Ex:
file.read().then(console.log);
Or using the example in the article:
var a = fileA.read();
var b = fileB.read();
promise.all([a,b]).then((data) => console.log(data[0], data[1]));
let [a, b] = await Promise.all([asyncA(), asyncB()])