The .finally() method runs whether the promise fulfills or rejects. Use it for cleanup that should happen either way.
showSpinner();
fetchData()
.then(displayData)
.catch(showError)
.finally(() => {
hideSpinner(); // Always runs
});
.finally() doesn't receive any arguments.