1
JavaScriptAdvanced#async#promises
A Promise is an object representing the eventual result of an async operation, in state pending, fulfilled or rejected. It settles once and then notifies then/catch/finally handlers.
const p = new Promise((resolve, reject) => {
setTimeout(() => resolve('done'), 100);
});
p.then(v => console.log(v)).catch(console.error).finally(() => console.log('cleanup'));