mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 14:57:08 +00:00
Time: 58 ms (80.2%), Space: 49.8 MB (30.62%) - LeetHub
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @param {Promise} promise1
|
||||
* @param {Promise} promise2
|
||||
* @return {Promise}
|
||||
*/
|
||||
var addTwoPromises = async function(promise1, promise2) {
|
||||
return (await promise1) + (await promise2)
|
||||
};
|
||||
|
||||
/**
|
||||
* addTwoPromises(Promise.resolve(2), Promise.resolve(2))
|
||||
* .then(console.log); // 4
|
||||
*/
|
||||
Reference in New Issue
Block a user