0

I want to execute some specific code logic at specific time. I have done it through, SetTimeOut or setInterval function which take the time and check it through if/else execute the desired code but i want to know that is there more efficient way available to do this job?

function checkVotingQuestionTime(){
    var currentTime = new Date();
    if(currentTime.getHours() >= 16 && currentTime.getHours() < 23)
    {
        checkVoteQuestionGenerated();
    }
}
setInterval(checkVotingQuestionTime, 60000);
Muhammad Faizan Khan
  • 10,013
  • 18
  • 97
  • 186

0 Answers0