Skip to content

Commit 1edfdb0

Browse files
committed
add 2723
1 parent 8333ff5 commit 1edfdb0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

2723-add-two-promises.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
2723. Add Two Promises
3+
4+
Submitted: January 07, 2025
5+
6+
Runtime: 56 ms (beats 86.69%)
7+
Memory: 48.71 MB (beats 97.66%)
8+
*/
9+
10+
/**
11+
* @param {Promise} promise1
12+
* @param {Promise} promise2
13+
* @return {Promise}
14+
*/
15+
var addTwoPromises = async function(promise1, promise2) {
16+
return (await promise1) + (await promise2);
17+
};
18+
19+
/**
20+
* addTwoPromises(Promise.resolve(2), Promise.resolve(2))
21+
* .then(console.log); // 4
22+
*/

0 commit comments

Comments
 (0)