Promise.resolve("1")
.then((res) => {
console.log(res);
})
.finally(() => {
console.log("finally");
});
Promise.resolve("2").finally(() => {
console.log("finally2");
});
Here is the output:
1
finally2
finally
Could anyone please explain why the finally2 is printed before finally?