I'm studying objects in JavaScript and confused when the new
keyword and ()
are required when using a object creation expression.
var a = new Date(); // current date and time
var b = Date(); // current date and time
var c = new Date; // current date and time
var d = Date; // => function Date() { [native code] }
Is there any difference in the first three methods? Why doesn't d
do as expected?