I have an existing 'if else' statement that functions correctly, but now I am seeking to add another condition to it. The initial statement is displayed below:
function showDateContent(){
var d=new Date();
if(d.getDate()>=11 && d.getMonth()+1 == 11){
//display something
}else{
//display something else
}
}
showDateContent();
The new conditional statement I am attempting to write is as follows (below), however, it does not seem to be working. In this case, I am trying to trigger actions based on the date falling within specific ranges in the first statement, followed by two additional conditions similar to the first example.
function showDateContent(){
var d=new Date();
if(d.getDate() > 11 && d.getDate() < 13 && d.getMonth()+1 == 11){
//display content for dates between 11 and 13
} else if(d.getDate() >= 14 && d.getMonth()+1 == 11){
//display content for dates after the 14th
}else{
//display alternative content for dates before the 11th
}
}
}
showDateContent();