On Node.js, when I execute the following two statements:
console.log(new Date);
console.log(new Date());
Both produce the same result.
What is the difference?
I have been told to use new Date(), although no reason was given.
On Node.js, when I execute the following two statements:
console.log(new Date);
console.log(new Date());
Both produce the same result.
What is the difference?
I have been told to use new Date(), although no reason was given.
from the syntax of new operator:
new constructor[([arguments])]
the parentheses is optional, so both expressions are valid.
console.log(new Date);
console.log(new Date());