Consider the code
let promiseEmployees;
const employeeFlag = DB.GetFromEMPDB(); // Goes to DAL and gets results
if (employeeFlag) {
promiseEmployees = async () => {
// Imp
// ...
// ...
// ...
};
}
Is it possible to rewrite this code in one line without writing literally the if (...) {...} ?
if (DB.GetFromEMPDB()) promiseEmployees = async () => {...}? By the way,promiseEmployeeswon't be a promise with your code anyway, it will be an async function. (It would be a promise if you'd also call the function.)