2723. Add Two Promises
Given two promises promise1 and promise2, return a new promise. promise1 and promise2 will both resolve with a number. The returned promise should resolve with the sum of the two numbers.
/**
 * @param {Promise} promise1
 * @param {Promise} promise2
 * @return {Promise}
 */
var addTwoPromises = async function(promise1, promise2) {
    // your code...
};

/**
 * addTwoPromises(Promise.resolve(2), Promise.resolve(2))
 *   .then(console.log); // 4
 */
// Input: 
promise1 = new Promise(resolve => setTimeout(() => resolve(2), 20)), 
promise2 = new Promise(resolve => setTimeout(() => resolve(5), 60))
// Output:
7
Решение
var addTwoPromises = async function(promise1, promise2) {
    return Promise.all([promise1, promise2]).then(([result1, result2]) => {
        return result1 + result2;
    })
};
Или решение с async await
var addTwoPromises = async function(promise1, promise2) {
    let result1 = await promise1;
    let result2 = await promise2;

    return result1 + result2;
};