4 ms·
async/await didn't hit javascript until 2017. in 2015 you picked between function foo(cb) { cb(42, null) } or function foo() { return new Promise((res
by vorticalbox 5mo ago
async/await didn't hit javascript until 2017. in 2015 you picked between
function foo(cb) {
cb(42, null)
}
or
function foo() {
return new Promise((resolve, reject) =>{ resolve(42) })
}
the second allowed for .then and .catch
foo.then((value) => console.log(value)).catch((error) => // handler error)
which isn't much better but did get us chaining
foo().then((v) => bar(v)).then((v) => baz(v)).catch()