Question 2
Consider the below JavaScript program.
new Promise((resolve, reject) => { if (10 > 5) reject(15) else resolve(25)}).then(d => { console.log("Success handler", d); return d * 2;}, d => { console.log("Error handler", d); throw new Error(30);}).catch(e => { console.log("Catch block", e.message); return e.message / 2;}).then(d => { console.log("Next then", d); return d + 10;}).finally(d => { console.log("Finally block", d); return d * 100;}).then(d => { console.log("Final then", d); return d * 3;})What will be the output of the above program?
Error handler 15
Catch block 30
Next then 15
Finally block 30
Final then 25Success handler 25
Next then 50
Finally block undefined
Final then 60Error handler 15
Catch block 30
Next then 15
Finally block 25
Final then 75Error handler 15
Catch block 30
Next then 15
Finally block undefined
Final then 25