aboutsummaryrefslogblamecommitdiffstats
path: root/2723/main.js
blob: 4d96883531e3433e21ea3fd4a0f6a18abb1e32eb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                           
#!/usr/bin/env node
"use strcit";

/**
 * @param {Promise} promise1
 * @param {Promise} promise2
 * @return {Promise}
 */
var addTwoPromises = async function (promise1, promise2) {
  const [v1, v2] = await Promise.all([promise1, promise2]);
  return v1 + v2;
};

/**
 * addTwoPromises(Promise.resolve(2), Promise.resolve(2))
 *   .then(console.log); // 4
 */