troubleshooting Question

Problem evaluating javascript equality expression

Avatar of -Dman100-
-Dman100-Flag for United States of America asked on
8 Comments1 Solution76 ViewsLast Modified:
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(...

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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros