File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * 2723. Add Two Promises
3
+ * https://leetcode.com/problems/add-two-promises/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given two promises promise1 and promise2, return a new promise. promise1 and promise2
7
+ * will both resolve with a number. The returned promise should resolve with the sum of
8
+ * the two numbers.
9
+ */
10
+
11
+ /**
12
+ * @param {Promise } promise1
13
+ * @param {Promise } promise2
14
+ * @return {Promise }
15
+ */
16
+ var addTwoPromises = async function ( promise1 , promise2 ) {
17
+ return Promise . all ( [ promise1 , promise2 ] ) . then ( ( [ a , b ] ) => a + b ) ;
18
+ } ;
Original file line number Diff line number Diff line change 440
440
2715|[ Timeout Cancellation] ( ./2715-timeout-cancellation.js ) |Easy|
441
441
2721|[ Execute Asynchronous Functions in Parallel] ( ./2721-execute-asynchronous-functions-in-parallel.js ) |Medium|
442
442
2722|[ Join Two Arrays by ID] ( ./2722-join-two-arrays-by-id.js ) |Medium|
443
+ 2723|[ Add Two Promises] ( ./2723-add-two-promises.js ) |Easy|
443
444
2724|[ Sort By] ( ./2724-sort-by.js ) |Easy|
444
445
3042|[ Count Prefix and Suffix Pairs I] ( ./3042-count-prefix-and-suffix-pairs-i.js ) |Easy|
445
446
3110|[ Score of a String] ( ./3110-score-of-a-string.js ) |Easy|
You can’t perform that action at this time.
0 commit comments