2

Possible Duplicates:
Is there a reason not to use new Object() in JavasScript?
Create an empty object in JavaScript with {} or new Object()?

In javascript, are the following two statements equivalent?

var c = new Object();

var c = {};
Community
  • 1
  • 1
John Livermore
  • 30,235
  • 44
  • 126
  • 216

1 Answers1

3

Yes. From §11.1.5 Object Initialiser:

The production ObjectLiteral : { } is evaluated as follows:

Return a new object created as if by the expression new Object() where Object is the standard built-in constructor with that name.

Community
  • 1
  • 1
Josh Lee
  • 171,072
  • 38
  • 269
  • 275