I want to use Promise.all() to handle two promise object, but the second is inner a if expression. How to handle this situation?
It looks like this:
functionA(); 
if(true) {
    functionB(); 
}
functionA() and functionB() both return a promise object. In normal case, I could use
Promise.all([
    functionA(),
    functionB()
]).then(resule => {
    console.log(result[0]);  // result of functionA
    console.log(result[1]);  // result of functionB
})
But how to handle with the if expression? Should I wrap the if(true){functionB()} in a new Promise()?
 
     
     
     
     
    