Organizational Research By

Surprising Reserch Topic

what is the difference between new object and object literal notation


what is the difference between new object and object literal notation  using -'javascript,object,jslint'

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?
    

asked Sep 16, 2015 by abhi
0 votes
8 views



Related Hot Questions

6 Answers

0 votes
NULL
answered Sep 16, 2015 by jekbishnoi
0 votes
NULL
answered Sep 16, 2015 by amit.gupta
0 votes
NULL
answered Sep 16, 2015 by sujata naik
0 votes
NULL
answered Sep 16, 2015 by mtabakade
0 votes
NULL
answered Sep 16, 2015 by rajeshujade
0 votes
NULL
answered Sep 16, 2015 by deepak07.s

...