I have an object that I need to check if it is defined. Also, I also want to check if a property of that object is true or false.
So what I want is
if ((typeof myVar !== 'undefined') && (myVar.isMale === false)) { // Do something 1 } else{ // Do something 2 } But this logic gives me error
Uncaught TypeError: Cannot read property 'isMale' of null What will be the best login to handle this condition ?
Thanks !
ifelseconditions. I need to have both conditions toDo Something 1. Else it should go toDo Something 2