Why Date() has different type from new Date() in JavaScript? -


when run in console

typeof new date()  

i object. if evaluate

typeof date() 

i string. why?

from the mdn:

note: javascript date objects can instantiated calling javascript date constructor: calling regular function (i.e. without new operator) return string rather date object; unlike other javascript object types, javascript date objects have no literal syntax.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -