Say, I have three javascript functions
How can this be worked out?
Thanks all. I tried all your solutions. Didn't quite work. I created a solution myself after trying for a while. Here it is:
let promise1 = new Promise(function(resolve, reject) {
setTimeout(() => resolve("promise1"), 1000);
});
let promise2 = new Promise(function(resolve, reject) {
setTimeout(() => resolve("promise2"), 4000);
});
Promise.all([promise1, promise2])
.then(result => {
console.log(result);
});
It creates two functions that runs the two functions as resolve. Then it is passed to Promise.all in an array, and the third function can be run in the then block of Promise.all.