In my code, I am checking a specific variable for conditions and modifying that variable within the code. How can I prevent the if condition from checking again once the condition is met? If the else-if condition is triggered and date2 becomes null, the code goes back and checks if date2 still equals null, causing both conditions to be executed.
if(date) {
if(date2 === null) {
// block of code
date2 = date;
}
else if(date2) {
// block of code
date2 = null;
}
}