mardi 9 octobre 2018

logic if statment in javascript

i have a simple code if statment like this

   if ((marker.category == str || $("#type").length === 0) && (marker.session == session || session.length === 0)){
           marker.setVisible(true); 
           console.log("session"+session);  
   } else if(marker.session == session || session.length === 0) {
       marker.setVisible(true); 
   }else{
       marker.setVisible(false);
       infowindow.close(map, marker1);
   }

}

if i run this code the code always read "else if" condition, but i think between "if" condition and "else if" condition are different, how to solve this problem? i know this logic may have same condition but with operator && it should be different, right? its really make me confused.

thanks in advanced.

-kraken

Aucun commentaire:

Enregistrer un commentaire