Verifique el valor variable y haga algo

// Long version  
if (isLoggedin) {   
    redirectToHomepage();   
}

//Shorthand  
isLoggedin && redirectToHomepage();   
Excited Emu