Function to search for weekends left in month I have a function that returns true or false depending upon whether there are any weekend days left in the month.  Is there a better/cleaner way that I can write this?

function checkWeekendsLeft(month, year) {
  var iDaysInMonth   = new Date(year, month, 0).getDate();
  var iCurDayInMonth = new Date().getDate();
  var x              = new Date();
  var weekends       = [];

  if (iDaysInMonth &gt;= iCurDayInMonth) {
    for(var i = iDaysInMonth; i &gt;= iCurDayInMonth; i--) {
      var iDayofMonth = i;
      var date = new Date(year, month - 1, iDayofMonth);
      var iDayOfWeek = date.getDay();
      if(iDayOfWeek === 6 || iDayOfWeek === 0) {
        weekends.push(iDayOfWeek);
      }
    }
    if(weekends.length &gt; 0) {
      return true;
    } else {
      return false;
    }
  }
}
You could use something like this :

function hasWeekendDaysLeft() {
  var today = new Date();
  var lastDayInMonth = new Date(today.getYear(), today.getMonth() + 1, 0).getDate();
  var numToday = today.getDate();

  return lastDayInMonth - numToday &gt; 6 - today.getDay();
}