Introduction
Like JavaScript Exceptions Finally, since ES2018 JavaScript JavaScript Promises also support .finally().
Syntax
promise
.then((result) => {})
.catch((error) => {})
.finally(() => {});Shorthand
promise.finally(() => {});is equal to
promise.then(
(result) => {
return result;
},
(error) => {
throw error;
}
);