MENU
finally()
The callback passed to finally() is always fired and does not take in any argument.
new Promise((resolve, reject) => {
resolve(2);
}).finally(() => {
console.log('executed on resolving');
}).then(x => {
console.log(x);
throw 'reject this';
}).finally(() => {
console.log('executed on rejection too');
}).catch(e => {
console.log(e);
});executed on resolving
2
executed on rejection too
reject this