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 Reply

Your email address will not be published. Required fields are marked *