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
  • 28,549
  • 42
  • 117
  • 207

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
  • 161,055
  • 37
  • 262
  • 269