Avatar of -Dman100-
Flag for United States of America

asked on 

Problem evaluating javascript equality expression

I am having an issue with the following javascript expression:
}else if(prnPosition == "Yes" && urgentCare && currentDate.getTime() < startDatePlus90Days.getTime()){
alert("We are in the 90 day branch");
}else if(prnPosition == "Yes" && currentDate.getTime() < startDatePlus180Days.getTime()){
alert("We are in the 180 day branch");
}else if(...

Open in new window

When the prnPosition is true and urgentCare is false and currentDateTime is less than the startDatePlus90Days it still goes into the 90 day branch. I would expect the code to bypass the 90 day branch and enter the 180 day branch.

It seems like something simple, but I'm not seeing why the code flows into the 90 day branch if the urgentCare variable value is false.  Do I need to explicitly say:

urgentCare == true

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon