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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - WPF+EF - The operation cannot be completed because the DbContext has been disposed -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -