loading
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const sendEmail = (userEmail) => {

  return new Promise(async (resolve,reject) => {

        setTimeout(() => {
            // return(`Email Sent to ${userEmail}`);
            resolve(`Email Sent to ${userEmail}`);
        },3000)

  })
}



const  sendEmails = async () => {

    const userEmails = ['[email protected]','[email protected]','[email protected]'];

    const status = await Promise.all(userEmails.map(async email => await sendEmail(email)));

    console.log("Status =>",status);

}

sendEmails();
node v10.16.0