Or with an unique line
Code:
Date.prototype.numberOfDays=function(){return new Date(this.getFullYear(),this.getMonth()+1,0).getDate()}