.finally(() =>console.log(" when am I called?

Referto the code below:

new Promise((resolve, reject) => {

const fraction = Math.random();

if( fraction >0.5) reject("fraction > 0.5, " + fraction);

resolve(fraction);

})

.then(() =>console.log("resolved"))

.catch((error) => console.error(error))

.finally(() =>console.log(" when am I called?"));

When does Promise.finally on line 08 get called?
A . When rejected
B . When resolved and settled
C . When resolved
D . When resolved or rejected

Answer: D

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments