Question 7
Consider the below JavaScript program.
const promise1 = new Promise((resolve, reject) => { setTimeout(() => { resolve('First promise resolved'); }, 1000);});
promise1 .then((result) => { console.log(result); return new Promise((resolve, reject) => { setTimeout(() => { resolve('Second promise resolved'); }, 3000); }); }) .then((result) => { console.log(result); return new Promise((resolve, reject) => { setTimeout(() => { resolve('Third promise resolved'); }, 3000); }); }) .then((result) => { console.log(result); }) .catch((error) => { console.log("Promise chain interrupted. Reason:", error); });Considering the asynchronous nature of promises in the above JavaScript program, what is the minimum time (in seconds) it will take for the entire execution to complete?
The program will never end
0 second
1 second
7 seconds
9 seconds