I am trying to execute an if condition in JSX in foolowing way
{
                        ((selectedWebsite != null) && (selectedWebsite.desktop_prompt != null) &&
                            (typeof selectedWebsite.desktop_prompt !== "undefined")) ?
                        <FormControlLabel style={{"margin-left": "auto"}}
                                          control={<Switch size="small"
                                                           checked={selectedWebsite.desktop_prompt.enabled}
                                                           onChange={handleCheckDesktop}/>}
                        /> :
                        null
                    }
now selectedWebsite is {} and desktop_prompt is undefined but still executing the if condition and i am getting the error TypeError: Cannot read property 'enabled' of undefined. what am i doing wrong here?
 
     
    