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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -