mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-21 19:16:23 +00:00
590 B
590 B
date | id | title |
---|---|---|
2020-11-11 | 189b65a7-906f-41fd-91cd-57c4cc5764d2 | JavaScript Promises Finally |
Introduction
Like Exceptions, since
ES2018 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;
}
);