javascript - simple jquery string count not working -
here code below...
var mymonth=new date().getmonth(); console.log((mymonth).length); i getting error undefined in console.. have tried..
console.log((new date().getmonth()).length); but still same error...iam supposed length of month 1 whats issue this???
mymonth numerical value not have length property, try
var mymonth=new date().getmonth(); console.log((''+ mymonth).length); or use numerical comparison below check whether month of 2 digits or not
mymonth < 10
Comments
Post a Comment