I am doing a comparison on dates in javascript. In this case date1 is empty "" and I can see the same in firebug. As per the code below, the first alert shouldn't be called because date1 == "", but for some reason the alert alert(" This is called...."); is invoked. What is wrong here?
if(date1 != null || date1 != ""){
if( (date1 != null || date2 != "") && (date1 < date2)){
alert(" This is called....");
break;
}
else{
alert(" That is called....");
break;
}
}
The above if condition is inside a for loop, hence the break.