lundi 23 juillet 2018

Decrease the "if statement"

I have problem with my one function. Can I reduce this section of code?

checkData(day,month,year,area){
  if(area == "year" && year == this.year)
        return true;

      if(area == "month" && month == this.div && year == this.year)
        return true;

      if(area == "day" && day == this.day && month == this.div && year == this.year)
        return true;

return false;
    }

Thank you very much!

Aucun commentaire:

Enregistrer un commentaire