aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2024-01-06 04:02:04 +0000
committerterminaldweller <devi@terminaldweller.com>2024-01-06 04:02:04 +0000
commitc7b7e28e965c74a64602c0854bf7497406379eb5 (patch)
treec1d84d9b094dbeb46cd6cfa33992c83fedff2b12
parent1235 (diff)
downloadleetcode-c7b7e28e965c74a64602c0854bf7497406379eb5.tar.gz
leetcode-c7b7e28e965c74a64602c0854bf7497406379eb5.zip
2723
-rwxr-xr-x2723/main.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/2723/main.js b/2723/main.js
new file mode 100755
index 0000000..4d96883
--- /dev/null
+++ b/2723/main.js
@@ -0,0 +1,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
+ */