The Promise all() static method takes an iterable of promises and returns a single Promise. This returned promise fulfills when all of the input promises fulfill with an array of the fulfillment values.

    
    const promise1 = Promise.resolve(3);
    const promise2 = 42;
    const promise3 = new Promise((resolve, reject) => {
      setTimeout(resolve, 300, 'foo');
    });

    Promise.all([promise1, promise2, promise3]).then((values) => {
      console.log(values);
    });
    // [3, 42, "foo"]