Create a function promiseMerge(p1, p2) that takes two promises and resolves into a single value containing both results.
The function should:
[result1, result2].Examples
const p1 = Promise.resolve(1); const p2 = Promise.resolve(2); promiseMerge(p1, p2).then(console.log); // [1, 2] const p3 = Promise.reject('error'); promiseMerge(p1, p3).catch(console.error); // 'error'
JavaScript Function
No test results yet
Click "Run" to execute tests