g2701_2800.s2723_add_two_promises.solution.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java21 Show documentation
Show all versions of leetcode-in-java21 Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
// #Easy #2023_09_18_Time_53_ms_(95.40%)_Space_43.2_MB_(24.42%)
async function addTwoPromises(promise1: Promise, promise2: Promise): Promise {
return (await promise1) + (await promise2)
}
/*
* addTwoPromises(Promise.resolve(2), Promise.resolve(2))
* .then(console.log); // 4
*/
export { addTwoPromises }