I have a variable const that i can't change the name. i want to be able to do a conditional check and change its value based on the Boolean value of a window.Variable. like code below. any help would be appreciated.
const routes = { () => window.showHide ? routes1 : routes2 }
const routes = window.showHide ? routes1 : routes2;
// Expression of right side is evaluated before it is assigned to const variable
also in fact if you feel you have any context issue or complex logic to have it inline, solve it using iifi
ex:
const routes = (() => {
let result;
// Write logic to get final value to assign in const and assign to result, which is retured from iifi function
return result//
})();