What is the difference between `new Object()` and object literal notation?

What is the difference between this constructor-based syntax for creating an object:

person = new Object()

…and this literal syntax:

person = {
    property1 : "Hello"
};

It appears that both do the same thing, although JSLint prefers you use object literal notation.

Which one is better and why?

12 Answers
12

Leave a Comment