I want to return from a function if some condition is met once Promise.all
resolves. But the return statement doesn't seem to have an effect and the function execution continues.
Here's my code:
function somefunc() {
Promise.all([match2, match3, match4, match5]).then(results => {
console.log(results);
if(results.indexOf(false) > -1) {
return; // has no effect. somefunc() does NOT return.
}
else {
// ............
};
}).catch(err => {
console.log(err);
});
// this continues to get executed even after the return staement
}